mongodb – Cannot authenticate into mongo, “auth fails” – use mongo admin etc – Stack Overflow

I’ve created an admin user for mongo using these directions: the mongo client it looks like I can authenticate:> use admin …………

Authentication is managed at a database level. When you try to connect to the system using a database, mongo actually checks for the credentials you provide in the collection .system.users. So, basically when you are trying to connect to “test”, it looks for the credentials in “test.system.users” and returns an error because it cannot find them (as they are stored in “admin.system.users”). Having the right to read and write from all db doesn’t mean you can directly connect to them. You have to connect to the db holding the credentials first. Try: mongo admin -u admin -p SECRETPASSWORD

For more info, check this

Source: mongodb – Cannot authenticate into mongo, “auth fails” – Stack Overflow