今天在慕課網(很不錯的一個it技術免費網站)上學習nodejs開發電影網站,其中使用到了mongo資料庫,但是在執行中遇到了如下錯誤!
failed to connect to 127.0.0.1:27017, reason: errno:10061 no connection could be made because the target machine actively refused it.
...
error: couldn't connect to server 127.0.0.1:27017 (127.0.0.1), connection attempt failed at src/mongo/shell/mongo.js:146 exception: connect failed
在http://stackoverflow.com/questions/23726684/mongodb-on-a-windows-7-machine-no-connection-could-be-made中找到了解決辦法,如下:
i got same error and fixed it by:
1) mkdir c:\data
2) cd data
3) mongod -dbpath .
4) now in another command window i was able to connect from my client using "mongo" command.
試了一下,使用兩個指令行,一個用于接收連接配接,一個用于發送連接配接。問題是解決了,但是還是沒發現問題的本質原因,如有知道了,請給我留言,謝謝各位。