我正在尝试向MongoDB添加授权.
我正在使用MongoDB 2.6.1在Linux上完成所有这些工作.
我的mongod.conf文件采用旧的兼容性格式
(这是安装时的方式).
1)我创建了管理员用户,如(3)中所述
http://docs.mongodb.org/manual/tutorial/add-user-administrator/
2)然后我通过取消注释这一行来编辑mongod.conf
auth = true
3)最后我重新启动了mongod服务,我尝试登录:
/usr/bin/mongo localhost:27017/admin -u sa -p pwd
4)我可以连接,但它在连接时说出来.
MongoDB shell version: 2.6.1
connecting to: localhost:27017/admin
Welcome to the MongoDB shell!
The current date/time is: Thu May 29 2014 17:47:16 GMT-0400 (EDT)
Error while trying to show server startup warnings: not authorized on admin to execute command { getLog: "startupWarnings" }
Run Code Online (Sandbox Code Playgroud)
5)现在看来sa我创建的这个用户根本就没有权限.
root@test02:~# mc
MongoDB shell version: 2.6.1
connecting to: localhost:27017/admin
Welcome to the MongoDB shell!
The current …Run Code Online (Sandbox Code Playgroud)