Error: can't connect to new replica set master / AuthenticationFailed: bad auth Authentication failed

Trying to connect with Mongo Shell (4.2). Below is error

(~/code/oms) mongo “mongodb+srv://sandbox-j5dz0.mongodb.net/test” --username m001-student --password m001-mongdb-basics
MongoDB shell version v4.2.3
connecting to: mongodb://sandbox-shard-00-01-j5dz0.mongodb.net:27017,sandbox-shard-00-02-j5dz0.mongodb.net:27017,sandbox-shard-00-00-j5dz0.mongodb.net:27017/test?authSource=admin&compressors=disabled&gssapiServiceName=mongodb&replicaSet=Sandbox-shard-0&ssl=true
2020-02-28T16:49:53.144-0800 I NETWORK [js] Starting new replica set monitor for Sandbox-shard-0/sandbox-shard-00-01-j5dz0.mongodb.net:27017,sandbox-shard-00-02-j5dz0.mongodb.net:27017,sandbox-shard-00-00-j5dz0.mongodb.net:27017
2020-02-28T16:49:53.145-0800 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-01-j5dz0.mongodb.net:27017
2020-02-28T16:49:53.145-0800 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-00-j5dz0.mongodb.net:27017
2020-02-28T16:49:53.145-0800 I CONNPOOL [ReplicaSetMonitor-TaskExecutor] Connecting to sandbox-shard-00-02-j5dz0.mongodb.net:27017
2020-02-28T16:49:53.473-0800 I NETWORK [ReplicaSetMonitor-TaskExecutor] Confirmed replica set for Sandbox-shard-0 is Sandbox-shard-0/sandbox-shard-00-00-j5dz0.mongodb.net:27017,sandbox-shard-00-01-j5dz0.mongodb.net:27017,sandbox-shard-00-02-j5dz0.mongodb.net:27017
2020-02-28T16:49:54.307-0800 I NETWORK [js] Marking host sandbox-shard-00-01-j5dz0.mongodb.net:27017 as failed :: caused by :: Location40659: can’t connect to new replica set master [sandbox-shard-00-01-j5dz0.mongodb.net:27017], err: AuthenticationFailed: bad auth Authentication failed.

*** It looks like this is a MongoDB Atlas cluster. Please ensure that your IP whitelist allows connections from your network.

2020-02-28T16:49:54.307-0800 E QUERY [js] Error: can’t connect to new replica set master [sandbox-shard-00-01-j5dz0.mongodb.net:27017], err: AuthenticationFailed: bad auth Authentication failed. :
connect@src/mongo/shell/mongo.js:341:17
@(connect):2:6
2020-02-28T16:49:54.310-0800 F - [main] exception: connect failed
2020-02-28T16:49:54.310-0800 E - [main] exiting with code 1

You’re missing an “o”.

1 Like

:flushed: thanks! silly mistake

As a gneral comment, tping erors are the most frequant cause ov problem. It should bee the f1rst thing to chek.

1 Like

Closing this thread as the issue has been resolved.