Skip to content

Instantly share code, notes, and snippets.

@PhongGCS
Created August 10, 2021 02:54
Show Gist options
  • Save PhongGCS/18fdb5d6afcd8052f721c56bc85ab094 to your computer and use it in GitHub Desktop.
Save PhongGCS/18fdb5d6afcd8052f721c56bc85ab094 to your computer and use it in GitHub Desktop.
/// Create new user have role owner with db
> mongo admin --username root --password <pwd>
> use prod
> db.createUser(
{
user: "prod",
pwd: "<pwd>",
roles: [ { role: "dbOwner", db: "prod" } ]
}
)
> exit
/// Show db
> show dbs;
/// Restore a backup to db f8
mongorestore --host 127.0.0.1 --username dbuser --password pass -d platform --port 27017 dbname
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment