Can't Connect to Mlab

xupv5 picture xupv5 · May 26, 2016 · Viewed 14.7k times · Source

I have a very simple Mlab account and I'm trying to connect via command line with this command:

mongo server_name.mlab.com:port/inventory -u <dbuser> -p <dbpassword> 

but I keep running into this problem:

2016-05-26T15:41:18.195+0200 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210 exception: login failed

How do I get rid of this and how can I connect to mlab easily?

Answer

Rafa Barragan picture Rafa Barragan · Aug 3, 2016

I think that you're using your mLab credentials. You must set a DB User at the User Tab like this:

Add Database user