Mongo: Couldn’t connect to server 127.0.0.1:27017

Python Zac 3 years ago (2018-02-14) 8171 views 0 comments

Error:

D:\>mongo
MongoDB shell version v3.6.0
connecting to: mongodb://127.0.0.1:27017
2018-02-14T13:33:47.147+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2018-02-14T13:33:47.148+0800 E QUERY [thread1] Error: couldn’t connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:251:13
@(connect):1:6
exception: connect failed

MongoDB connect to server failed

 

How to fix:

Occurred this error because you did not open the MongoDB server.

Open MongoDB server: mongod –dbpath “your MongoDB data folder path”

 

My situation:

MongoDB data folder

 

In my situation, just type: mongod –dbpath “D:\MongoDB\Server\3.6\data”

fix Mongodb error

 

It works!

Hope this is helpful to you. If you have any questions, please comment it. I will reply you as soon as possible.

Like (19)
Comment
Cancel comment

emoji Image Bold Strilethrough Center Italic

Your email and address

  • Name (Required)
  • Email (Required)
  • Website(Optional)