Skip to content

Instantly share code, notes, and snippets.

@maxp
Created August 3, 2017 02:21
Show Gist options
  • Save maxp/4990be5d5c4bd6f58cb6ec7c3f599bba to your computer and use it in GitHub Desktop.
Save maxp/4990be5d5c4bd6f58cb6ec7c3f599bba to your computer and use it in GitHub Desktop.
MongoDB create admin and dbuser
use admin
db.createUser({user:'root',pwd:'ADMPASS',roles:['root']})
mongo -u root -p ADMPASS localhost/admin
use MYDB
db.createUser({user:'MYUSER',pwd:'MYPASS',roles:['readWrite']})
mongo -u MYUSER -p MYPASS localhost/MYDB
# mongodb.conf:
# security.authorization enabled
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment