Help Center/ Document Database Service/ Troubleshooting/ Connection Failure Message: Authentication failed
Updated on 2023-06-14 GMT+08:00

Connection Failure Message: Authentication failed

Symptom

An error is reported when you run the following command to connect to a DDS DB instance:

mongo --host 192.168.168.116 --port 8635 -u rwuser -p xxxxxxxxx --authenticationDatabase admin --ssl --sslCAFile /root/ca.crt --sslAllowInvalidHostnames

Error message:

MongoDB shell version v3.4.17
connecting to: mongodb://192.168.168.116:8635/
2019-09-19T09:39:24.306+0800 W NETWORK  [thread1] The server certificate does not match the host name. Hostname: 192.168.168.116 does not match CN: 172.16.2.65
MongoDB server version: 4.0.3
WARNING: shell and server versions do not match
2019-09-19T09:39:24.329+0800 E QUERY    [thread1] Error: Authentication failed. :
DB.prototype._authOrThrow@src/mongo/shell/db.js:1461:20
@(auth):6:1
@(auth):1:2
exception: login failed

Possible Cause

When connecting to a DDS instance, you need to enter the administrator password. If the entered password is incorrect, the message "Authentication failed" is displayed.

Fault Locating

Check whether the administrator password in the command for connecting to the DDS instance is correct.

Solution

  • Enter the correct administrator password.
  • If you forget your password, click the DB instance. On the displayed Basic Information page, click Reset Password in the Administrator field to reset the password.
    Figure 1 Resetting a password