Cannot authenticate into mongo, “auth fails”

前端 未结 12 1254
无人及你
无人及你 2020-11-30 21:40

I\'ve created an admin user for mongo using these directions:

http://docs.mongodb.org/manual/tutorial/add-user-administrator/

From the mongo client it looks

12条回答
  •  执笔经年
    2020-11-30 22:21

    I also received this error, what I needed was to specify the database where the user authentication data was stored:

    mongo -u admin -p SECRETPASSWORD --authenticationDatabase admin

    Update Nov 18 2017:

    mongo admin -u admin -p
    

    is a better solution. Mongo will prompt you for your password, this way you won't put your cleartext password into the shell history which is just terrible security practice.

提交回复
热议问题