简体   繁体   中英

Couldn't connect to server 127.0.0.1:27017 on Windows 7

I have problem with connecting to the server on mongodb:

mongo
MongoDB shell version: 3.0.1
connecting to: test
Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:179
exception: connect failed
  • Set up the MongoDB environment (MongoDB's default data directory path is \\data\\db):

     md \\data\\db 
  • Start MongoDB (Assuming MongoDB is at "C:\\mongodb")

     C:\\mongodb\\bin\\mongod.exe 
  • Connect to MongoDB

     C:\\mongodb\\bin\\mongo.exe 

More Details here .

Run the mongod server: mongod --dbpath /root/hemant/mongodb_data/data/db

Once the server started listening to the port 27017. Run the mongo.exe

You might get an error like below: Error: couldn't connect to server 127.0.0.1:27017 src/mongo/shell/mongo.js:179 exception: connect failed

Restart the machine, this works in my case.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM