连接到 mlab

Connecting to mlab

我正在尝试连接到我在 mLab 中的数据库。我当然创建了一个帐户,然后数据库添加了一个用户(crud)。然后我尝试使用此命令通过 mongo shell 进行连接:

$ mongo ds046027.mlab.com:46027/crud -u crud -p 123456

总是遇到这个错误:

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

我也试过使用字符串 uri:

mongodb://crud:123456@ds046027.mlab.com:46027/crud

我的 VS Code 中出现了这个错误:

failed to connect to server [ds046027.mlab.com:46027] on first connect 
[MongoError: connect ETIMEDOUT 52.178.209.192:46027]

注意:通过 mongod 连接到默认 localhost:27017 工作正常,我可以访问数据库并使用它执行任何操作。

我有 mongo 3.6.0,我知道如果这是其中之一,它会有一些问题。我该如何解决?

更新: 这些是我正在执行的所有步骤,如果我遗漏了什么请告诉我,

希望你能找到任何东西!!

我连接到我大学的 wifi,结果证明这是问题所在!