I can't connect to MongoDB via command line

I’m new to MongoDB. I have MongoDB Shell installed and when I type the following commands in the Command Prompt to connect:

cd C:\Program Files\mongosh

mongosh “mongodb+srv://cluster0.5zir0am.mongodb.net/” --apiVersion 1 --username AtilaOMagnifico

After entering my password I get the following error:

MongoServerSelectionError: 94370000:error:0A000438:SSL routines:ssl3_read_bytes:tlsv1 alert internal error:C:\data\mci\64c6\tmp\boxednode\mongosh\node-v20.19.0\deps\openssl\openssl\ssl\record\rec_layer_s3.c:1605:SSL alert number 80
. It looks like this is a MongoDB Atlas cluster. Please ensure that your Network Access List allows connections from your IP.

And what makes me the most angry is that it used to work the first few times I connected it!

Are you sure your permission to access from your current IP address did not expire?
Are you behind a firewall?
Could the firewall be sometimes connecting presenting a different IP address than the one you gave to Atlas?

So what should I do? Could you give me a step by step guide?

Well, the first thing I’d do is check how I have my Atlas network access set up.
If I think that’s correct, I’d ask my network people if when I make a connection outside the firewall it can come up with different addresses.
One way to test that is to browse to https://whatismyipaddress.com/ a few times at different times in the day and see what your IP address is. Maybe the firewall outgoing assigns from a block of IP addresses in round-robin fashion.
In that case, assign that block to your Atlas network access.

Instead of browsing, you can typically just ask duck-duck-go search engine “what is my ip address?”

I solved this problem by clicking Connect in the Clusters view and Add Your Current IP Address, as this tutorial says: “https://www.mongodb.com/pt-br/docs/atlas/government/tutorial/allow-ip/”.

1 Like

This topic was automatically closed 5 days after the last reply. New replies are no longer allowed.