mongodb 版本
> version();
3.2.6
查看用户
> db.system.users.find();
> db.getUsers();
删除用户
> db.dropUser('peiyb')
创建用户
> db.createUser({user:"peiyb",pwd:"peiybpeiyb",roles:[{role:"root",db:"admin"}]})
Successfully added user: {
"user" : "peiyb",
"roles" : [
{
"role" : "root",
"db" : "admin"
}
]
}
修改密码
> db.changeUserPassword('peiyb','peiybpeiyb2');
原创文章,作者:奋斗,如若转载,请注明出处:https://blog.ytso.com/9841.html