1
在我的MongoDB我有這樣的DB分配給用戶的「主」的角色,在「管理」 DB:失敗的登錄與admin DB中設置正確的憑據 - MongoDB的
{
"_id" : "admin.master",
"user" : "master",
"db" : "admin",
"roles" : [
{
"role" : "dbOwner",
"db" : "admin"
},
{
"role" : "dbOwner",
"db" : "cars"
}
]
}
現在,如果我嘗試訪問在命令行蒙戈以「汽車」分貝:
mongo 127.0.0.1/cars -u "master" -p
輸入密碼後,我得到這個錯誤:
connecting to: 127.0.0.1/cars 2014-11-22T12:23:27.377+0000 Error: 18 { ok: 0.0, errmsg: "auth failed", code: 18 } at src/mongo/shell/db.js:1210 exception: login failed
如果我而我嘗試訪問mongo:
mongo 127.0.0.1/admin -u "master" -p
因此我可以登錄。
爲什麼我不能直接連接到數據庫「汽車」?
由於使用the --authenticationDatabase
option
謝謝,做的工作! – mex23 2014-11-22 16:37:17