标签:
db.createUser(
{
user:"root",
pwd:"root",
roles:
[
{
role:"userAdminAnyDatabase",
db:"admin"
}
]
}
);
use test
db.system.users.remove({user:"test"});
或者
db.dropUser("test")
新建用户db.addUser(‘test‘,‘test123‘);
使用以上旧的命令会有warning,不过还是可以创建成功
WARNING: The ‘addUser‘ shell helper is DEPRECATED. Please use ‘createUser’ instead
建议还是通过以下命令创建
db.createUser(
{
user:"test",
pwd:"test123",
roles:
[
{
role:"dbOwner",
db:"test"
}
]
}
);
标签:
原文地址:http://www.cnblogs.com/haoliansheng/p/4417915.html