1

"ctx":"conn18","msg":"Authentication failed","attr":{"mechanism":"SCRAM-SHA-1","speculative":false,"principalName":"user","authenticationDatabase":"user_db","remote":"172.20.0.8:51928","extraInfo":{},"error":"UserNotFound: Could not find user "user" for db "user_db""}}

where user is my username & user_db is the database name

1
  • Please clarify your specific problem or provide additional details to highlight exactly what you need. As it's currently written, it's hard to tell exactly what you're asking. Commented Sep 1, 2021 at 9:50

1 Answer 1

2

Add the authSource=admin at the end of the uri in spring-boot application.yml file

spring:
  data:
    mongodb:
      uri: mongodb://user:pass@localhost:27017/user_db?authSource=admin
Sign up to request clarification or add additional context in comments.

3 Comments

no it doesnt fix it, still wont connect MONGO_URI_PROD=mongodb://${MONGO_INITDB_ROOT_USERNAME}:${MONGO_INITDB_ROOT_PASSWORD}@mongo:27017/${MONGO_INITDB_DATABASE}?authSource=admin
Probably you have some other issue also along with this one.
i had to delete files from volume too

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.