This commit is contained in:
light
2017-12-02 23:10:36 +08:00
parent b2d9201c76
commit 73037972e1
5 changed files with 32 additions and 4 deletions
+10 -2
View File
@@ -6,11 +6,19 @@ $ mongo
> use admin
> db.createUser({
user: "root",
pwd: "root",
pwd: "123456",
roles: [ { role: "userAdminAnyDatabase", db: "admin" }]
}
)
db.auth('root', '123456')
db.createUser({
user: "light",
pwd: "123456",
roles: [ { role: "root", db: "admin" }]
}
)
# mongodb://light:123456@127.0.0.1:27017/
# mongodb://tester:xyz123@127.0.0.1:27017/test
use test
db.createUser(
{