当前位置: 代码迷 >> 综合 >> Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password
  详细解决方案

Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password

热度:111   发布时间:2023-09-21 17:48:32.0
错误如下:Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password=<hidden>, mechanismProperties={}}; nested exception is com.mongodb.MongoSecurityException: Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1, userName='', source='test', password=<hidden>, mechanismProperties={}}"}

 

原因和解决方法:

因为在properties中配置了两句:

spring.data.mongodb.username=
spring.data.mongodb.password=

导致需要用户名和密码,username就是'',password就是hidden MongoDB如果没有特殊配置不要写下面两条语句

 

解决方法:去掉这两句就行了

  相关解决方案