Question:
Implementation db.auth (‘username ‘,’ password ‘),
monodb authentication failed,
error: authentication failed.
appears
environment
Root, admin, and business database user authentication failed
Solution
-
- stop mongodb and open it without authentication,
##Go to the bin directory
cd
##stop
mongod --shutdown --dbpath=/soft/mongo/mgserver/data/
##start
./mongod --dbpath=/soft/mongo/mgserver/data/ --logpath=/soft/mongo/mgserver/logs/mongod.log --logappend --port=27017 --fork
verify
mongo
show dbs
use ${your db}
show users
use admin
show users
Modify password
3.1 modify root password:
#
mongo
#
db.changeUserPassword('root','${new password}')
#
exit
#closed
mongod --shutdown --dbpath=/soft/mongo/mgserver/data/
#Certification Launch
./mongod --dbpath=/soft/mongo/mgserver/data/ --logpath=/soft/mongo/mgserver/logs/mongod.log --auth --logappend --port=27017 --fork
#
mongo
#
use admin
#user, pwd
db.auth('','')
Similarly, change the password of other users
3.2 new users
#
mongo
#
use ${your db}
#
db.createUser({
user: "",
pwd:"",
roles:[{role:"readWrite",db:""}]
})
Similar Posts:
- [Solved] MongoDB Start ERROR: child process failed, exited with error number
- Mongovue is unable to create collections and log in with user name and password
- [Solved] Mongodb Error: NETWORK [thread1] Failed to connect to 127.0.0.1:27017
- Mongodb access control is not enabled for the database
- [Solved] Mongodb startup error: about to fork child process, waiting until server is ready for connections.
- Error occurred when using java to connect mongodb: command failed with error 18 (authentication failed): “authentication failed.”
- Mongodb Cannot Start: child process failed, exited with error number 100
- [Solved] TypeError: ‘Collection’ object is not callable. If you meant to call the ‘authenticate’ method on a ‘Database’ object it is failing because no such method exists.
- Unable to start mongod after installing mongodb in Ubuntu
- Raspberry pie: How to Solve Mongodb installation error