我正在尝试从 MongoLab 开始。使用 mongo shell 似乎我无法对我创建的任何数据库进行身份验证,即使使用全新的帐户和数据库也是如此。
我使用与我的 DB 用户相同的用户名和密码创建了 MongoLab 用户,所以我确定没有用户名/密码错误。
# connect to mongod v2.4.3 using 2.4.3 client:
#
imac ~/Desktop/mongodb-osx-x86_64-2.4.3/bin$ ./mongo ds059557.mongolab.com:59557/cachv -u redacted -p redacted
MongoDB shell version: 2.4.3
connecting to: ds059557.mongolab.com:59557/cachv
> use mydb
switched to db mydb
> db.things.insert({f:1})
not authorized for insert on mydb.things
或者
# connect to mongod v2.2.4-rc0 using 2.4.3 client:
#
imac ~/Desktop/mongodb-osx-x86_64-2.4.3/bin$ ./mongo dbh83.mongolab.com:27837/cachv2 -u redacted -p redacted
MongoDB shell version: 2.4.3
connecting to: dbh83.mongolab.com:27837/cachv2
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
http://docs.mongodb.org/
Questions? Try the support group
http://groups.google.com/group/mongodb-user
Error while trying to show server startup warnings: need to login
> use mydb
switched to db mydb
> db.things.insert({f:1})
Sat Apr 27 05:46:32.456 JavaScript execution failed: getlasterror failed: { "errmsg" : "need to login", "ok" : 0 } at src/mongo/shell/db.js:L698
> db.auth('redacted','redacted')
Error: 18 { errmsg: "auth fails", ok: 0.0 }
0
随后进行了第二次尝试:
imac ~/Desktop/mongodb-osx-x86_64-2.4.3/bin$ ./mongo dbh83.mongolab.com:27837/cachv2 -u redacted -p redacted
MongoDB shell version: 2.4.3
connecting to: dbh83.mongolab.com:27837/cachv2
Error while trying to show server startup warnings: need to login
最后,我下载了较旧的 2.2.4 客户端,但还是不走运:
# connect to mongod v2.2.4-rc0 using 2.2.4 client:
#
mac ~/Desktop/mongodb-osx-x86_64-2.2.4/bin$ ./mongo dbh83.mongolab.com:27837/cachv2 -u redacted -p redacted
MongoDB shell version: 2.2.4
connecting to: dbh83.mongolab.com:27837/cachv2
> use mydb
switched to db mydb
> db.things.insert({'g':1})
Sat Apr 27 06:00:30 uncaught exception: getlasterror failed: { "errmsg" : "need to login", "ok" : 0 }
> db.auth('redacted','redacted')
Error: { errmsg: "auth fails", ok: 0.0 }
0
> db.things.insert({'g':1})
Sat Apr 27 06:00:47 uncaught exception: getlasterror failed: { "errmsg" : "need to login", "ok" : 0
是否有任何额外的端口必须在我的末端打开?
任何人都可以帮忙吗?
谢谢!
达伦