mongodb 3.x 客户端连接上不原因之---authSchema 类型

查看日志,发现有一句:

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
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 1
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论 1
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值