查看日志,发现有一句:
Failed to authenticate admin@admin with mechanism MONGODB-CR: AuthenticationFailed MONGODB-CR credentials missing in the user document
3.0.3以前版本是ok的。
1.首先删除所有用户db.dropUser("xxx");
2.退出mongodb,无auth启动
3.创建超级用户,不是root哦,root无法操作system开头的,
是 __system 超级角色
> use admin
switched to db admin
> db.createUser(
... {
... user: "xxx",
... pwd: "xxx",
... roles: [ { role: "__system", db: "admin" } ]
... }
... )
Successfully added user: {
"user" : "maclean_dbdao2",
"roles" : [
{
"role" : "__system",
"db" : "admin"
}
]
}
4.修改system.version文档里面的authSchema版本为3,初始安装时候应该是5,命令行如下:
> use admin
switched to db admin
> var schema = db.system.version.findOne({"_id" : "authSchema"})
> schema.currentVersion = 3
3
> db.system.version.save(schema)
WriteResult({ "nMatched" : 1, "nUpserted" : 0, "nModified" : 1 })
5.重启服务,ok
http://21jhf.iteye.com/blog/2216103
http://liyanjie918.blog.163.com/blog/static/2022729020156261410274/
http://www.sufeinet.com/thread-11978-1-1.html
http://www.tuicool.com/articles/fMZbUzu
mongodb 3.x 客户端连接上不原因之---authSchema 类型
猜你喜欢
转载自zlr.iteye.com/blog/2296424
今日推荐
周排行