MongoDB 3.2 – server returned error on SASL authentication step: Authentication failed.

MongoDB 3.2 – server returned error on SASL authentication step: Authentication failed.

This issue will happen to all MongoDB tools (mongo, mongodump, mongotop, mongostat). However, I encounter the issue while using mongotop.

#mongotop --host=192.168.56.104:27017 -u username -p "THIS1sR3tard3d!!" --authenticationDatabase=admin 5
mongotop --host=192.168.56.104:27017 -u superuser -p "THIS1sR3tard3dmongostat --host=192.168.56.104:27017 --username=user --password='THIS1sR3tard3d!!' --authenticationDatabase=admin " --authenticationDatabase=admin 5
2016-11-17T17:43:59.523+0000 Failed: error connecting to db server: server returned error on SASL authentication step: Authentication failed.

The issue is with the password with special characters. Apparently, even when you double quote a password, it still doesn’t ignore the special characters. t doesn’t help the situation when the error message is really vague.

#mongotop --host=192.168.56.104:27017 -u username -p 'THIS1sR3tard3d!!' --authenticationDatabase=admin 5

To solve the issue, simply single quote the password field đŸ™‚

Update:

Apparently, escaping the special characters using single quote works too!

mongo -u username -p '1234'@''@'' --authenticationDatabase admin <ip>:port/db

Hope this helps

Regards,
Wei Shan

Advertisements
  1. Leave a comment

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s

%d bloggers like this: