1

I have a documentdb cluster, I m unable to connect to documentDB when I pass username and password args at once

mongo --host <myDocDbHost>:27017 --username admin --password <myPassword> I get following error

connecting to: mongodb://< myDocDbHost>:27017/?gssapiServiceName=mongodb
2021-10-26T21:09:17.228+0000 E QUERY    [js] Error: Authentication failed. :
connect@src/mongo/shell/mongo.js:356:17
@(connect):2:6
exception: connect failed

Where as when I try mongo --host <myDocDbHost>:27017 --username admin and enter password in next prompt where it asks for Password I m able to connect. I verified that I m using the correct password in both cases. I had same issue when I tried to connect directly from EC2 instance in same VPC as documentDB and through ssh tunneling as well. Can someone help me connect to db by passing both username and password args at once

4
  • 1. mongo is the shell not db, 2. Does you password have special symbols? Commented Oct 27, 2021 at 1:11
  • try this : mongo --host HOST --port PORT -u USERNAME -p PASSWORD Commented Oct 27, 2021 at 4:13
  • See stackoverflow.com/questions/63754742/… The (default) Authentication database depends on the connection string. Commented Oct 27, 2021 at 5:22
  • Found the issue its due to special chars in password. I m able to login now. I updated password to not have any special chars thanks all Commented Oct 27, 2021 at 15:36

0

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.