Skip to content

Instantly share code, notes, and snippets.

@iworkforthem
Created January 10, 2017 07:42
Show Gist options
  • Save iworkforthem/fbcf488571db22e70fa787c223fa2024 to your computer and use it in GitHub Desktop.
Save iworkforthem/fbcf488571db22e70fa787c223fa2024 to your computer and use it in GitHub Desktop.
MongoDB Shell create user.
use admin
db.createUser(
{
user: "",
pwd: "",
roles: [ { role: "userAdminAnyDatabase", db: "admin" } ]
}
)
mongo --port 27017 -u "" -p "" --authenticationDatabase ""
db.copyDatabase('admin','')
db.createUser({
user: "",
pwd: "",
roles: [{ role: 'readWrite', db:''}]
})
mongo --port 27017 -u "" -p "" --authenticationDatabase ""
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment