Skip to main content

MongoDB

Start MongoDB server on system startup,

sudo systemctl enable mongod.service

Connect to database,

mongosh --port 27017

Create a new user with admin right,

use admin
db.createUser(
{
user: "pyclient",
pwd: passwordPrompt(),
roles: [
{ role: "userAdminAnyDatabase", db: "admin" },
{ role: "readWriteAnyDatabase", db: "admin" }
]
}
)

Show collections,

show collections
show tables