Authentication failed

hi i keep getting the authentication failed error when i try to connect to the host via compass.

Were you able to resolve your issue? You may want to check out the earlier posts and the lecture notes.

Hi mariam_34273,

Please note that the password for m001-student is m001-mongodb-basics. Here is the screenshot of my connection parameters.

Let me know if it helps.



Hi there

I am currently experiencing this error, I have entered the given password on numerous occasions.

I would really appreciate it if I can be assisted.

ok thanks.

am trying again now

Hi all… I am currently facing same error of authentication with given credentials… Could anyone please suggest

Try again, with the same credentials. I also had the same issue, and I managed to log-in

Hi All, I am getting the same error “authentication fail” with given credentials, can someone please help. I need to finish this class today as it is the last day.

Hi All, I have used the credentials used above (same from course) but still getting the following error msg:

"Could not connect to MongoDB on the provided host and port ".

Need help in connecting compass to proceed to rest of the course and is required for the labwork due today. Thanks in advance.

Password: m001-mongodb-basics for cluster: “”, user: “m001-student”


Try pinging the cluster from your command line:


And if 27017 port is getting used in some other process, you need to stop the process. In linux, you can find top processes using top command.

For more cluster connection issues, check this: Compass Connection [Solution]


Had the same error, then noticed that I copied a space before the username. Might be the case for others, too!


Hi , you can try setting your IP whitelist into this. Just go to your atlast account, then click cluster, then Security.

Thank you @Balint_22890…yeah, extra spaces before username. My problems is solved.

1 Like

Yeah it worked, When i tried as you said. The mistake is only in typing the username and password manually. But i didn’t get what these host name, replica set names are. Still having a doubt on those.

Host Name: Hostname is used to connect to a mongod instance. This hostname can be a hostname, an FQDN, an IPv4 address, or an IPv6 address.

Replica Set Name: Replica Set is a set of servers with the copies of data. Usually, it is a set of 3 mongod servers with 1 Primary and 2 Secondary servers. So, replica set name is the name given for whole replica set. More information is given here in docs-replication. And there is M103 course which covers the topic in detail.


after using above solution it connects but I got following error in red lines:
An error occurred while loading navigation: ‘not master and slaveOk=false’: It is recommended to change your read preference in the connection dialog to Primary Preferred or Secondary Preferred or provide a replica set name for a full topology connection.

Are you connecting to your Sandbox cluster or Class cluster?
Try with read preference as Primary preferred

Hi @Dhananjay_Wadhavane,

Please use srv type connection string. It will always connect you to the Primary node of the Atlas replica set.

You can get the srv connection string for your cluster from your Atlas account.

~ Shubham