Ano*_*der 3 authentication mongodb nosql
我对MongoDb有点新,我使用的是MongoDb v.2.4.问题在于,当我使用--auth参数运行mongod时,即使在验证后我也无法执行简单的操作,例如"show users".但是如果我在没有--auth参数的情况下运行mongod,那么工作正常.
> use admin
switched to db admin
> db.auth("dbadmin","mypassword")
1
> show users
**Thu Feb 27 16:50:17.695 error: { "$err" : "not authorized for query on admin.sys
tem.users", "code" : 16550 } at src/mongo/shell/query.js:128**
Run Code Online (Sandbox Code Playgroud)
> use admin
switched to db admin
> db.grantRolesToUser("your_admin_name" ,[ "root"])
Run Code Online (Sandbox Code Playgroud)
此命令将以admin身份为您提供任何数据库的所有权限.
| 归档时间: |
|
| 查看次数: |
31537 次 |
| 最近记录: |