spring-boot-starter-data-mongodb 賬號信息正確,卻報認證失敗的問題

報錯信息爲:com.mongodb.MongoCommandException: Command failed with error 18 (AuthenticationFailed): 'Authentication failed.' on server 192.168.100.99:27017. The full response is {"ok": 0.0, "errmsg": "Authentication failed.", "code": 18, "codeName": "AuthenticationFailed"}

解決方式: 

加上authentication-database參數

設置以auth方式登陸之後,client端通過mongo登陸mongodb,是必須加上“--authenticationDatabase”選項的,“authenticationDatabase”指定了校驗用戶賬戶名和密碼的數據庫
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章