Cannot create admin user with local host bypass

453 views
Skip to first unread message

John Myers

unread,
Aug 19, 2015, 11:01:36 AM8/19/15
to mongodb-user
I've followed these instructions: 


I'm assuming the localhost bypass is working, since I am able to connect w/ the local mongo client.

When I try and create the first user this is what I get...

MongoDB shell version: 3.0.5
connecting to: test
> use admin
switched to db admin
> db.createUser({user: "admin", pwd: "password", roles: [{role: "userAdminAnyDatabase", db: "admin"}]})
2015-08-19T10:57:59.081-0400 E QUERY    Error: couldn't add user: not authorized on admin to execute command { createUser: "admin", pwd: "xxx", roles: [ { role: "userAdminAnyDatabase", db: "admin" } ], digestPassword: false, writeConcern: { w: "majority", wtimeout: 30000.0 } }
    at Error (<anonymous>)
    at DB.createUser (src/mongo/shell/db.js:1101:11)
    at (shell):1:4 at src/mongo/shell/db.js:1101

What is the right way to do this?

Ankit Kakkar

unread,
Aug 20, 2015, 11:03:32 AM8/20/15
to mongodb-user
Hi John,

Thanks for reaching out to us. Can you please let me know how you are connecting to the mongod? Are you using localhost or ip/machine name to connect?

Regards,
ankit
Reply all
Reply to author
Forward
0 new messages