Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

Unable to connect to MongoLab "auth fails" error

Tags:

I am new to mongo. Recently created an account in 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

What is missing in this? Kindly advice.

like image 668
Hannan Shaik Avatar asked Dec 11 '13 17:12

Hannan Shaik


People also ask

Why is my MongoDB not connecting?

These are some of the solutions: Ensure that your MongoDB instance is running: Compass must connect to a running MongoDB instance. Also check you have installed MongoDB and have a running mongod process. You should also check that the port where MongoDB is running matches the port you provide in the compass connect.


2 Answers

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).

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

like image 110
ChrisV Avatar answered Oct 01 '22 08:10

ChrisV


Thanks to pneumee.

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

It is working now.

like image 35
Hannan Shaik Avatar answered Oct 01 '22 10:10

Hannan Shaik