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