当我从OS Shell进行连接时,
mongo --port 27017 -u "testusr" -p "testpwd" --authenticationDatabase "testdb"
总是将我登录到测试数据库中,而不是将我带到testdb,我在这里想念的是什么?
db.auth("testusr","testpwd")
没有任何身份验证问题吗?如何重定向到正确的数据库?
以下对我有用
mongo localhost:27017/testdb -u "user" -p "pass" --authenticationDatabase "testdb"
您可以找到帮助(我在Linux中使用过)
mongo --help
usage: mongo [options] [db address] [file names (ending in .js)]
db address can be:
foo foo database on local machine
192.169.0.5/foo foo database on 192.168.0.5 machine
192.169.0.5:9999/foo foo database on 192.168.0.5 machine on port 9999
本文收集自互联网,转载请注明来源。
如有侵权,请联系[email protected] 删除。
我来说两句