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”指定了校验用户账户名和密码的数据库
發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章