Welcome!

Join our community of MMO enthusiasts and game developers! By registering, you'll gain access to discussions on the latest developments in MMO server files and collaborate with like-minded individuals. Join us today and unlock the potential of MMO server development!

Join Today!

mongodb authorization

Newbie Spellweaver
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
 
Joined
Apr 16, 2007
Messages
441
Reaction score
204
the reason why you can't see the database is because you are most likely using the wrong db login credentials, you still have not answered me from your help thread regarding this. you are also posting this topic in the wrong section.

first of all is your server files running? if they are then instead of trying to login with user: admin_name, pwd:1234
read your configs and get the login from there then you can login with those credentials.

another thing u might want to try is run mongodb without the -auth command then connect without a user/pass or with one to see if it shows up, but in theory if your server files are running then it means the databases have been created, but where has it been created depends on your setup environment and how you did things.



 
Upvote 0
Back
Top