How to connect MongoDB Compass using MLab connection string

Digvijay picture Digvijay · Sep 14, 2018 · Viewed 8.4k times · Source

I have database hosted on MLab and I am trying to connect it with Compass. I am using host and port given in connection string but it is showing error, here is my screenshot:

Compass

What am I doing wrong?

Answer

elad BA picture elad BA · Dec 29, 2018

Had same problem manage to solve it like this:

mLab user tab

A. Go to your db in mlab and in the tab choose "users"

B. Create a new user ex: username: admin password: 123456

C: Go to compass and fill it this way

Example of your connection path

ds012345.mlab.com:56789/myDBname

hostname

ds012345.mlab.com

port

56789

authentication: username /password

admin // or the name of the user you created in step A
123456 // or password for the user you created in step A

authentication database

myDBname // the name of your database in mlab