mongodb执行dropDatabase报错"not authorized on xxx to execute command { dropDatabase:1.0,$db:"xxx"}"解决办法
warning:
这篇文章距离上次修改已过188天,其中的内容可能已经有所变动。
此错误是因为没有授权给admin用户对system数据库执行命令的权限,解决方法如下:
db.grantRolesToUser ( "用户名", [ { role: "__system", db: "admin" } ] )