Reputation: 1775
C:\Program Files\MongoDB\Server\3.4\bin>mongo
MongoDB shell version v3.4.7
connecting to: mongodb://127.0.0.1:27017
2017-08-11T15:37:19.430+0800 W NETWORK [thread1] Failed to connect to 127.0.0.1:27017 after 5000ms milliseconds, giving up.
2017-08-11T15:37:19.433+0800 E QUERY [thread1] Error: couldn't connect to server 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:237:13
@(connect):1:6
exception: connect failed
My PC's local IP address is not 127.0.0.1
Originally I had localhost mapped to the PC's local IP address in the Windows hosts file.
I changed this to: 127.0.0.1 localhost
in hosts, but the issue remains.
Help appreciated.
Upvotes: 0
Views: 1105
Reputation: 421
You need to create data/db directory and give the below command. mongod --dbpath d:\test\mongodb\data
It will start running at 27017 port. If pou want to change the port then add --port portnumber
Assuming you have already set the environment variable
Upvotes: 2