关于MONGODB 用户认证问题
边城cn 2014-03-28 01:48:21 我在非ADMIN数据库中,添加一个用户,登录时,就会出一个错误:
Error while trying to show server startup warnings: not authorized on admin to execute command { getLog: "startupWarnings" }
哪位知道怎么解决的????请指教!
#1,添加用户:
> use mdsp
switched to db mdsp
> db.addUser("u1","u1");
WARNING: The 'addUser' shell helper is DEPRECATED. Please use 'createUser' instead
Successfully added user: { "user" : "u1", "roles" : [ "dbOwner" ] }
#用户认证
> db.auth("u1","u1")
1
>
在另一窗口进行登录测试:
#3 刚加完用户后,登录:
[mongo@localhost ~]$ cd $MONGO_HOME/bin
[mongo@localhost bin]$ ./mongo localhost:28001/mdsp -u u1 -p u1
MongoDB shell version: 2.5.5
connecting to: localhost:28001/mdsp
Error while trying to show server startup warnings: not authorized on admin to execute command { getLog: "startupWarnings" }
看到这个错误出来了。
> exit
bye
#4 在用户认证后,再登录。问题依然存在:
[mongo@localhost bin]$ ./mongo localhost:28001/mdsp -u u1 -p u1
MongoDB shell version: 2.5.5
connecting to: localhost:28001/mdsp
Error while trying to show server startup warnings: not authorized on admin to execute command { getLog: "startupWarnings" }
>
#版本为:
> version()
2.5.5
>