I'm currently trying to set up a secure MongoDB database for my various applications, but whenever I try to login with a username and password, but the shell always replies with Error: Authentication failed. and keeps me from accessing my database.

Errors from mongod --auth:

2016-02-12T17:11:57.039-0600 I ACCESS [conn1] SCRAM-SHA-1 authentication failed for app-client on application-userdata from client ; UserNotFound Could not find user app-client@application-userdata

Can someone give me some help as to trying to make this work? I've already tried dropping and re-adding the user, but that does nothing. In case it matters, the user only has the readWrite role enabled.

(Ubuntu 15.10, x86_64)


Look at that, I figured it out. Turns out I had to change mongod.conf to enable authentication.

For those who are coming here in the future, add the following to /etc/mongod.conf:

security: authorization: enabled

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.