centos mongodb 3.4 认证配置

2017-09-13 20:47:09来源:CSDN作者:ucmir183人点击

分享

use admin
db.createUser({user: “root”, pwd: “123456”, roles:[“root”]})
重启mongodb
mongod –auth –port 27017 –dbpath /var/lib/mongodb

mongo -u “root” -p “123456” –authenticationDatabase “admin”

use cd2
db.createUser({user: “cd2”, pwd: “cd2”, roles:[“dbOwner”]})
If you see success messsage, disconnect from mongo shell and reconnect with new user credentials.

mongo /cd2 -u “cd2” -p “cd2”

最新文章

123

最新摄影

微信扫一扫

第七城市微信公众平台