MongoDB remote connection via RoboMongo

tubu13 picture tubu13 · Jan 6, 2015 · Viewed 16.8k times · Source

I'm trying to connect to my Mongodb server via Robomongo.

I have changed the Bind_ip to 0.0.0.0 at the server mongod.conf I have also set the auth=true field.

Now when I'm trying to log in from RoboMongo I'm getting auth fail error.

To be honest i have no idea what is the user name or password (I didn't set any user after installing Mongo, and i prefer not to because I'm using nodeJs to query the db and when i try to log in I'm getting auth fail as well [thats with mongoskin])

Does Mongodb have default user name or password? or what else can I do?

Answer

Stennie picture Stennie · Jan 7, 2015

Does Mongodb have default user name or password?

There are no default users created by MongoDB, however if you have just enabled authentication and haven't created your first user yet (which should be a user administrator), then you have to connect via localhost to set up up the initial user. There is a localhost exception enabled by default to specifically to allow creation of the first user with auth enabled. Remote connections will not be able to authenticate without valid user credentials.

After you have created the required user(s), you should then be able to login remotely with those credentials using Robomongo or another interface like the mongo shell or your mongoskin app.

If you don't want to use the localhost exception an alternative approach would be to start your MongoDB server with auth disabled, add the required users remotely, and then restart the server with auth enabled.