mongodb认证错误
使用springboot连接mongodb报错
org.springframework.data.mongodb.UncategorizedMongoDbException:
Exception authenticating MongoCredential{mechanism=SCRAM-SHA-1,
userName='testuser', source='admin', password=<hidden>,
mechanismProperties=<hidden>}; nested exception is
com.mongodb.MongoSecurityException: Exception authenticating
MongoCredential{mechanism=SCRAM-SHA-1, userName='testuser',
source='admin', password=<hidden>, mechanismProperties=<hidden>}
两种配置方法:
host: 121.36.56.112
port: 27017
username: root
password: "123456"
database: test
authentication-database: admin
# uri: mongodb://root:123456@121.36.56.112:27017/test?authSource=admin&authMechanism=SCRAM-SHA-1