mongodb 错误 SCRAM-SHA-1 authentication failed for --转

前端之家收集整理的这篇文章主要介绍了mongodb 错误 SCRAM-SHA-1 authentication failed for --转前端之家小编觉得挺不错的,现在分享给大家,也给大家做个参考。

log 日志错误信息

2018-10-24T16:14:42.244+0800 I NETWORK [initandlisten] connection accepted from 192.168.1.198:37354 #165 (2 connections now open)
2018-10-24T16:14:42.250+0800 I ACCESS [conn165] SCRAM-SHA-1 authentication Failed for djx123 on djx_test from client 172.16.2.208 ; UserNotFound Could not find user djx123@djx_test
2018-10-24T16:14:42.253+0800 I NETWORK [conn165] end connection 192.168.1.198:37354 (1 connection now open)
2018-10-24T16:14:42.756+0800 I NETWORK [initandlisten] connection accepted from 192.168.1.198:37356 #166 (2 connections now open)
2018-10-24T16:14:42.762+0800 I ACCESS [conn166] SCRAM-SHA-1 authentication Failed for djx123 on djx_test from client 172.16.2.208 ; UserNotFound Could not find user djx123@djx_test
2018-10-24T16:14:42.765+0800 I NETWORK [conn166] end connection 192.168.1.198:37356 (1 connection now open)
2018-10-24T16:14:43.268+0800 I NETWORK [initandlisten] connection accepted from 192.168.1.198:37358 #167 (2 connections now open)
2018-10-24T16:14:43.274+0800 I ACCESS [conn167] SCRAM-SHA-1 authentication Failed for djx123 on djx_test from client 172.16.2.208 ; UserNotFound Could not find user djx123@djx_test

 

mongodb 加入了SCRAM-SHA-1校验方式,需要第三方工具配合进行验证,下面给出具体解决办法: 

首先关闭认证(noauth = yes),修改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 })  

复制代码

 更改后用之前的用户进行登录的话还是登录不了,因为之前之前的用户是基于之前的认证生成的,

我们将之前的用户删除删除后重新创建用户

重新连接,成功。

可以查看一下链接介绍:

https://docs.mongodb.com/master/release-notes/3.0-scram/

还有国外友人的回答:

http://stackoverflow.com/questions/29006887/mongodb-cr-authentication-failed

本文转自https://www.cnblogs.com/timelesszhuang/p/5668589.html

猜你在找的MongoDB相关文章