在学mongodb。版本是version: 3.0.6
> use admin
switched to db admin
> db.auth('super','super');
1
> show dbs
admin 0.078GB
local 0.078GB
test 0.078GB
>
>
> db.shutdownServer();
assert failed : unexpected error: Error: shutdownServer failed: not authorized on admin to execute command { shutdown: 1.0 }
Error: assert failed : unexpected error: Error: shutdownServer failed: not authorized on admin to execute command { shutdown: 1.0 }
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at assert (src/mongo/shell/assert.js:20:5)
at DB.shutdownServer (src/mongo/shell/db.js:212:9)
at (shell):1:4
2015-09-15T08:08:53.788+0800 E QUERY Error: assert failed : unexpected error: Error: shutdownServer failed: not authorized on admin to execute command { shutdown: 1.0 }
at Error (<anonymous>)
at doassert (src/mongo/shell/assert.js:11:14)
at assert (src/mongo/shell/assert.js:20:5)
at DB.shutdownServer (src/mongo/shell/db.js:212:9)
at (shell):1:4 at src/mongo/shell/assert.js:13
请问这个错误怎么解决?
没权限
notauthorizedonadmintoexecutecommand{shutdown:1.0}
也看到没有权限,但是为啥没有权限啊?
db.createUser(
{
user:"super",
pwd:"super",
roles:
[
{role:"userAdminAnyDatabase",db:"admin"}
]
}
)
版权声明:本文内容由阿里云实名注册用户自发贡献,版权归原作者所有,阿里云开发者社区不拥有其著作权,亦不承担相应法律责任。具体规则请查看《阿里云开发者社区用户服务协议》和《阿里云开发者社区知识产权保护指引》。如果您发现本社区中有涉嫌抄袭的内容,填写侵权投诉表单进行举报,一经查实,本社区将立刻删除涉嫌侵权内容。