Unable to connect to MongoLab "auth fails" error

Hannan Shaik picture Hannan Shaik · Dec 11, 2013 · Viewed 26.2k times · Source

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.

Answer

ChrisV picture ChrisV · Nov 4, 2015

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