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
db.collectionname.find()
backup all db command
mongodump
singole database

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

restore db command

mongorestore /db databasename /dir:dir.dump/db/

 

Leave a Reply