- Joined
- Oct 26, 2013
- Messages
- 85
- Reaction score
- 22
how to setup an --auth mode in mongodb?
i run mongo like:
mongod --auth --dbpath "C:\data"
open mongo.exe and write:
use admin (local is default)
db.createUser({user:"admin_name", pwd:"1234",roles:["readWrite","dbAdmin"]})
then check the connect:
db.auth("admin_name","1234")
that show me 1 (connection success)
But i can't see all db, only admin
so i can't create user in logindb for ex. i only get a error:
[thread1] Error: couldn't add user: not authorized on gameserver to execute command { createUser: "admin_name", pwd: "xxx", roles: [ "readWriteAnyDatabase", "dbAdminAnyDatabase", "userAdminAnyDatabase" ], digestPassword: false, writeConcern: { w: "majority", wtimeout: 30000.0 } } : _getErrorWithCode@src/mongo/shell/utils.js:23:13
p.s.
i try to change roles, but can't create user after
i run mongo like:
mongod --auth --dbpath "C:\data"
open mongo.exe and write:
use admin (local is default)
db.createUser({user:"admin_name", pwd:"1234",roles:["readWrite","dbAdmin"]})
then check the connect:
db.auth("admin_name","1234")
that show me 1 (connection success)
But i can't see all db, only admin
so i can't create user in logindb for ex. i only get a error:
[thread1] Error: couldn't add user: not authorized on gameserver to execute command { createUser: "admin_name", pwd: "xxx", roles: [ "readWriteAnyDatabase", "dbAdminAnyDatabase", "userAdminAnyDatabase" ], digestPassword: false, writeConcern: { w: "majority", wtimeout: 30000.0 } } : _getErrorWithCode@src/mongo/shell/utils.js:23:13
p.s.
i try to change roles, but can't create user after