我在mlab.com上有一个帐户
mlab托管部署正在运行MongoDB 3.0
我在我的电脑上安装了MongoDB 3.0.10
我使用以下命令连接到mlab.com:
mongo ds019480.mlab.com:<port>/<database> -u <username> -p <password>
但我收到错误消息:
MongoDB shell version: 3.0.10-4-gbd56c2f
connecting to: ds019480.mlab.com:19480/larry-database
2016-04-08T08:45:27.101+0800 E QUERY Error: 18 Authentication failed.
at DB._authOrThrow (src/mongo/shell/db.js:1271:32)
at (auth):6:8
at (auth):7:2 at src/mongo/shell/db.js:1271
exception: login failed
如何成功连接到mlab.com?
答案 0 :(得分:3)
从密码中删除所有标志/符号。特别是&#39;!&#39;和&#39; $&#39;。
答案 1 :(得分:0)
除了使用您的Heroku或mLabs用户名/密码的常见错误之外,另一个人可能正在使用&#34;双引号&#34;。
mongo ds012345.mlab.com:<port>/<database> -u "username" -p "password"
exception: login failed
mongo ds012345.mlab.com:<port>/<database> -u 'username' -p 'password'
rs-ds012345:PRIMARY>
What’s the Difference Between Single and Double Quotes in the Bash Shell?
结论:单引号中的所有字符都被解释为字符串字符。