MongoDB Admin
Set/reset admin password
Make sure authentication is disabled in
/etc/mongod.confby settingsecurity authorization: disabledor comment it out.Restart MongoDB using
sudo service mongod restartAccess the mongo shell commands using the terminal command
mongoshthis will start an interactive shell session.Type
db.getSiblingDB("admin").changeUserPassword("root", "PASSWORD")and change PASSWORD to your choice, please use a random password with special characters.Type
exitto exit the mongo shell.Enable authentication in
/etc/mongod.confby settingsecurity authorization: enabledRestart MongoDB again
sudo service mongod restart
Last updated