mongodb 无法连接到 MongoLab“身份验证失败”错误

声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow 原文地址: http://stackoverflow.com/questions/20525435/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me): StackOverFlow

提示:将鼠标放在中文语句上可以显示对应的英文。显示中英文
时间:2020-09-09 13:32:17  来源:igfitidea点击:

Unable to connect to MongoLab "auth fails" error

mongodbmlab

提问by hannanessay

I am new to mongo. Recently created an account in mongoLab.

我是 mongo 的新手。最近在 mongoLab 中创建了一个帐户。

I am trying to connect to the database using the below statement.

我正在尝试使用以下语句连接到数据库。

mongo ds039487.mongolab.com:39487/webbies -u <dbuser> -p <dbpassword>

Getting the below error

得到以下错误

MongoDB shell version: 2.4.8
connecting to: ds039487.mongolab.com:39487/webbies
Wed Dec 11 22:30:16.686 Error: 18 { code: 18, ok: 0.0, errmsg: "auth fails" } at src/mongo/shell/db.js:228
exception: login failed

Note: dbuser - is an User created in mongoLab

注意:dbuser - 是在 mongoLab 中创建的用户

What is missing in this? Kindly advice.

这其中缺少什么?友善的建议。

回答by ChrisV

Old thread, but just in case it helps anyone else: my problem was using shell version 2.4.9 to connect to mongo db version 3.0.7 (http://docs.mongolab.com/connecting/#mongo_shell).

旧线程,但以防万一它对其他人有帮助:我的问题是使用 shell 版本 2.4.9 连接到 mongo db 版本 3.0.7 ( http://docs.mongolab.com/connecting/#mongo_shell)。

Updating my shell sorted it (https://docs.mongodb.org/master/tutorial/install-mongodb-on-ubuntu/).

更新我的 shell 对其进行了排序(https://docs.mongodb.org/master/tutorial/install-mongodb-on-ubuntu/)。

回答by hannanessay

Thanks to pneumee.

感谢 pneumee。

The issue was because I was using my mongolab.com username and password, instead of the database username and password.

问题是因为我使用的是 mongolab.com 用户名和密码,而不是数据库用户名和密码。

It is working now.

它现在正在工作。

回答by Simon

OK - I figured it out and would also like to add onto pneumee's answer.

好的 - 我想通了,也想添加到 pneumee 的答案中。

  1. Go to mongolab.com
  2. Login.
  3. Navigate to the "Users" tab.
  4. If you have forgotten your Username and Password for the database, I suggest you "Add a new user" and supply it with the username and password.
  1. 访问 mongolab.com
  2. 登录。
  3. 导航到“用户”选项卡。
  4. 如果您忘记了数据库的用户名和密码,我建议您“添加新用户”并提供用户名和密码。

db username and db password

db 用户名和 db 密码

回答by Johnathan Douglas

default users in db

数据库中的默认用户

login: admin 
password: admin

check users in https://mongolab.com/databases/MYDBNAME#users

检查https://mongolab.com/databases/MYDBNAME#users 中的用户

my problem was being putting login and password mongolab

我的问题是输入登录名和密码 mongolab