当你到cmd里,输入mongo.exe,报错:
JavaScript execution failed: Error: couldn’t connect to server 127.0.0.1:27017 at src/mongo/shell/mongo.js:L112
1、windows用户解决方法:
- go to services.msc stop MongoDB service.停止服务
- then go to your data directory of Mongodb
- there is one ".lock" file, delete it.在db/data文件夹下删除.lock的这个文件
- start MongoDB service重启
- Done
我在data文件下下面删除.lock文件,然后重启才解决问题的。
2、苹果用户:
Open Terminal and type following command
First Stop service
sudo service mongodb stop |
Then remove the Mongo log file with following
sudo rm /var/lib/mongodb/mongod.lock |
then change the permission of the Mongo Library and give full control to mongodb
sudo chown -R mongodb:mongodb /var/lib/mongodb/ |
Finally start Mongo service
sudo service mongodb start |