Hi All,
I need some urgent help — how do I log in as a super user to a 3.2 mongodb instance running locally on a Windows 2012 host?
I was recently told we have a mongodb instance 3.2 running on a local windows 2012, it is not on Atlas. I need to create a user for development team so they can investigate a production issue.
I can run a command window as an administrator on the host (they just gave me this access). see below:
PS C:\Program Files\MongoDB\Server\3.2\bin> ./mongo
MongoDB shell version: 3.2.19-24-g70faecde6a
connecting to: test
show dbs
2022-09-28T09:07:27.049-0700 E QUERY [thread1] Error: listDatabases failed:{
"ok" : 0,
"errmsg" : "not authorized on admin to execute command { listDatabases: 1.0 }",
"code" : 13
} :
_getErrorWithCode@src/mongo/shell/utils.js:25:13
Mongo.prototype.getDBs@src/mongo/shell/mongo.js:62:1
shellHelper.show@src/mongo/shell/utils.js:781:19
shellHelper@src/mongo/shell/utils.js:671:15
@(shellhelp2):1:1
exit
What I need to do is be able to log in as a super user and run below to create a new read only user:
db.createUser({user: “newreadonlyuser”, pwd: “newpassword”, roles: [{role: “readAnyDatabase”, db: “ourdb”}]})
PS. I was given a user/pass that I can use to login to make changes on the above database “ourdb”, but it appears it has no privilege to create a new user.
Any help would be highly appreciated!!
Thanks!
Erin