MongoError: bad auth : Authentication failed

If you are having the error: MongoError: bad auth : Authentication failed, it must be that the password you have supplied in your connection string to connect to a particular database user in mongodb from your application is incorrect.

Mind you do not confuse your mongodb account password with the password you created for the particular user of the database you are trying to connect to – you may not have used the same password.

If you have forgotten the password you supplied for the database user, you should follow the steps below to change the password so that you can supply the right password in the mongodb connection string.

  1. Login to your mongodb account and click on: Database Access – follow the marker in image1 above.
  2. Click on Edit button for the user you want to change password for – look on the side where you have the marker in image2, that is the user – the Edit button is on the right side for this user.
  3. On the popup, you can see (look at the third image above) that password is already highlighted; click on the Edit Password button – see marker on the third image above – and enter the new password, scroll down and click the Update User button when you are done.

You now put the new password in the connection string and try again – the error should be gone now.

Leave a Reply

Your email address will not be published. Required fields are marked *

This site uses Akismet to reduce spam. Learn how your comment data is processed.

You May Also Like