我正在学习MongoDB,当我尝试启动mongoDb时,它会抛出以下错误:
C:\Users\Mahadev>mongo
MongoDB shell version: 3.2.3
connecting to: test
2016-02-18T14:45:06.028+0530 W NETWORK [thread1] Failed to connect to 127.0.0.1
:27017, reason: errno:10061 No connection could be made because the target machi
ne actively refused it.
2016-02-18T14:45:06.029+0530 E QUERY [thread1] Error: couldn't connect to ser
ver 127.0.0.1:27017, connection attempt failed :
connect@src/mongo/shell/mongo.js:224:14
@(connect):1:6
exception: connect failed
如何解决错误?
答案 0 :(得分:0)
试试这个,
解决了我的问题是创建了一个将startmongo.conf
设置为bind_ip
的文件127.0.0.1
。之后,我刚刚创建了一个*.bat
来启动mongo,比如:
mongod --config c:\mongodb\bin\startmongo.conf
参考:Mongodb: Failed to connect to 127.0.0.1:27017, reason: errno:10061
答案 1 :(得分:0)
愿这项工作
sudo mongod --repair
sudo mongod
(忘记服务并开始)
然后在另一个标签/终端上:
mongo