Skip to content

Instantly share code, notes, and snippets.

@navopw
Last active May 6, 2017 14:45
Show Gist options
  • Save navopw/cec323e6810f433ae1bf2c25338f9b5d to your computer and use it in GitHub Desktop.
Save navopw/cec323e6810f433ae1bf2c25338f9b5d to your computer and use it in GitHub Desktop.
MongoDB: How to add admin user & database user
use admin
db.createUser({
user: "<username>",
pwd: "<password>",
roles: [
"userAdminAnyDatabase",
"dbAdminAnyDatabase",
"readWriteAnyDatabase"
]
})
use databasename
db.createUser({
user: "databasename",
pwd: "<password>",
roles: [
{ role: "readWrite", db: "databasename" }
]
})
@navopw
Copy link
Author

navopw commented Feb 17, 2017

Look at the revisions, I posted the database password for pllx.eu 🤣
You dont have to try it, I changed it 👍

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment