Reputation: 500
I am trying to connect to my database in mLab. I created an account of course, and a DB then added a user (crud). Then I tried connecting through mongo shell using this command:
$ mongo ds046027.mlab.com:46027/crud -u crud -p 123456
always end up facing this error:
MongoDB shell version v3.6.0
connecting to: mongodb://ds046027.mlab.com:46027/crud
2017-12-21T19:13:58.264+0300 W NETWORK [thread1] Failed to connect to
52.178.209.192:46027 after 5000ms milliseconds, giving up.
2017-12-21T19:13:58.265+0300 E QUERY [thread1] Error: couldn't connect to
server ds046027.mlab.com:46027, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed
I also tried using the string uri:
mongodb://crud:[email protected]:46027/crud
and this error comes up in my VS Code:
failed to connect to server [ds046027.mlab.com:46027] on first connect
[MongoError: connect ETIMEDOUT 52.178.209.192:46027]
Note: connecting to the default localhost:27017 through mongod works just fine and I can access the database and do anything with it.
I have mongo 3.6.0 and I know it has some problems if that's one of them. how can I fix it?
UPDATE: These are all the steps I'm following, tell me if I'm missing something,
cmd: mongo ds046027.mlab.com:46027/crud -u crud -p 123456
hope you can find anything!!
Upvotes: 0
Views: 757
Reputation: 500
I was connected to my university's wifi and it turns out that it is the problem!
Upvotes: 0