mongo - couldn't connect to server 127.0.0.1:27017

后端 未结 30 2404
故里飘歌
故里飘歌 2020-11-27 09:43

I am coming from riak and redis where I never had an issue with this services starting, or to interact.

This is a pervasive problem with mongo and am rather clueless

30条回答
  •  悲&欢浪女
    2020-11-27 10:28

    This was happening with me today and I resolved it in following way.

    Machine: I'm using Windows 10 machine and downloaded the latest MongoDB - Community edition.

    So, the problem was, I did not have C:\data\db created.

    Without creating C:\data\db, I opened CMD terminal and started the database using mongod command at terminal

    C:\YourInstallationPath\bin>mongod

    And when I fired mongo command then I was getting the problem.

    Twist, I created the necessary folders but still was getting the problem. And this is because mongo server was already running. To fix it, I fired up mongod command again, and it automatically referenced to C:\data\db.

    Other users have suggested to add C:\data\db but did not talk about executing mongod again, which exactly solved my problem.

提交回复
热议问题