MongoVUE Message – Invalid credentials for database

Being new to the MongoDB database, only in my second week of training,  I wanted to test the MongoVUE gui tool to see if it would help make my administration easier.

On a local virtual machine, I have a copy of MongoDB running on Ubuntu.  Up until this point, I have been doing everything in the Mongo shell.

After installing an evaluation version of MongoVUE, I attempted to have it connect to the my Mongo database called “pcat”.  “Pcat” is the database that I am using in my training class.  I appeared to receive a successful connection to the database using my OS logon & password.  However, when I clicked to view the Collections, I received the message: “Invalid credentials for database ‘pcat’.

InvalidCredentials

In this case, I had two issues with to resolves before I could connect and administer the ‘pcat’ database:

1. Configure the MongoDB software to authenticate for remote connections.

2. Create a user that I can authenticate in the ‘pcat’ database.

——————————————————————————————————

The first step is to alter the configuration file that the process ‘mongod’ is using.  On the server, by running ‘ps -ef | grep mongod’, I was able to see that the process was using the configuration file ‘mongodb.conf’ that resided in the ‘/etc’ directory.  The configuration file may reside in a different location based on your operating system & configuration at setup.

mongod_process

Using an editor on that file (like vi), I was able to see that the authentication parameter for remote users was remarked out.  I removed the pound sign in front of the “auth = true”, and saved the file.  Then I restarted the Mongod process by typing “sudo service mongodb restart”.  Now remote users are able to authenticate to the database.

mongo.conf

Second, we need a user that is permitted to access the database remotely.  In the Mongo shell I had to switch to the ‘pcat’ database, by typing “use pcat”.  Then I added a user with the command db.addUser, like db.addUser(” <username> ” , ” <password> “).  In my example, I used “buddy” for both the name & password.  I then verified the user with the “show users” command.

AddUser

After creating the user, I was able to go back to my MongoVUE application, and enter the connection information in the “MongoVUE Connection”, with an example pictured below.

ConnectionInfo

Then I was able to successfully connect to the MongoDB database, and view the Collections.

PCAT

If this does not resolved the error, then check the “mongodb.log” on the database server, which is normally located in the “/var/log/mongodb” directory.

Categories: Linux

2 Comments

  • whilda says:

    I got a same problem but I used mongodb 3.0.1. There is no addUser command. Can you update your post for latest version of mongodb?

    I can connect with terminal on local server. But, if using third party (such as MongoVUE) the auth failed always appeared. I have no idea about that.

    • BlogAdmin says:

      It appears that the addUser has been replaced by createUser with the following syntax:

      use admin
      db.createUser(
      {
      user: “siteUserAdmin”,
      pwd: “password”,
      roles: [ { role: “userAdminAnyDatabase”, db: “admin” } ]
      }
      )

      Please refer to: http://docs.mongodb.org/manual/reference/method/db.createUser/#db.createUser

      It appears to have changed in version 2.6.

      I am waiting on Bitnami to publish a virtual machine with MongoDB 3.0. Their most current release available is 2.6.7, as of this update.

      Thanks for reading!!!