Mongo Configuration

Create admin user:

Connect with mongo command, then type use admin.

After run db.createUser({user: “mongo”, pwd: “mongo”, roles: [“userAdminAnyDatabase”]});

the new user you set is mongo and password mongo but you can choose what you want.

use these command:

show collections
use admin    ->   db.system.namespaces.find()
show dbs
backup all db command
singole database

mongodump –host –port 27017 –db db –out ./db.dump

restore db command

mongorestore –db farad –dir farad.dump/farad/

start the service :
service mongod start

setup the service automatically start at the boot:
systemctl enable mongod

Leave a Reply