-
use admin db.createUser( { user: "admin", pwd: "***", roles: [ { role: "userAdminAnyDatabase", db: "admin" }, "clusterAdmin" // For db.serverStatus() ] } )
-
Enable auth (and disable bind 127... if needed) in /etc/mongod.conf
-
mongo -u admin -p --authenticationDatabase admin
use db db.createUser( { user: "user", pwd: "***", roles: [ { role: "dbOwner", db: "db" } ] } )
Last active
August 29, 2015 14:13
-
-
Save halilim/263206929b44d4df1669 to your computer and use it in GitHub Desktop.
Set Up MongoDB (2.6 and 3) Authentication
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment