Last active
April 20, 2018 13:54
-
-
Save cdimascio/84700f98cc285bfba6a64e63abfbced5 to your computer and use it in GitHub Desktop.
Create MongoDB user via Mongo shell
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
# start the mongo shell, then set to the appropriate db and create a user | |
# in this case, create a user with dbadmin, and read write access roles | |
use my_db | |
db.createUser( { user: "my_user", pwd: "MyP@ssw0rd", roles: [ { role: "readWrite", db: "my_db"}, { role: "dbAdmin", db: "my_db" } ] }) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment