2

I am trying to launch a Mongodb instance as follows and running into error as below, how do I debug this?please provide guidance on how to fix this error

mongo automation --host machine40.scv.company.com -u admin -p passd

2018-05-15T21:11:30.346-0700 I ACCESS   [conn3] SCRAM-SHA-1 authentication failed for admin on automation from client 17.xxx.xxx.x:54756 ; UserNotFound: Could not find user admin@automation
Jeremyapple
  • 253
  • 2
  • 6
  • 20
  • add `--authenticationDatabase automation` or wherever you actually created the user. You're really "supposed to" create the user in the `admin` database, but you've created it in a different database so you need to specify which database that is. – Neil Lunn May 16 '18 at 04:43
  • @Jeremyapple The command to connect to mongo server passes **username** as **admin** and **password** as **passd**, this user is being authenticated against **automation** database. The Mongo error shows that the user admin wasn't created under automation database _Could not find user admin@automation_. Use the database in which the username admin was created. Also, as Neil mentioned in the above comment use the new standard **--authenticationDatabase automation** – mintekhab May 16 '18 at 05:02
  • Ex : mongo --port 27017 -u "myUserAdmin" -p "abc123" --authenticationDatabase "admin" Useful Link : https://stackoverflow.com/questions/4881208/how-to-secure-mongodb-with-username-and-password?utm_medium=organic&utm_source=google_rich_qa&utm_campaign=google_rich_qa – IftekharDani May 16 '18 at 06:11

1 Answers1

4

Please refer below step.

1) log into mongo console as super admin user.

mongo admin --host machine40.scv.company.com -u admin -p passd

2) Then check, is there any user call admin who can authenticate to access "automation" DB. Sample output given below

{
    "_id" : "XXXXXX",
    "user" : "admin",
    "db" : "automation",
    "roles" : [
        {
            "role" : "root",
            "db" : "automation"
        }
    ]
}
Chamaz
  • 160
  • 1
  • 7