Cannot start MongoDB as a service

后端 未结 24 1553
情话喂你
情话喂你 2020-12-07 10:07

I have been developing for MongoDB for some months now and would like to install it as a service on my Windows 7 Enterprise machine. The following is the command that I hav

24条回答
  •  广开言路
    2020-12-07 10:20

    I started following a tutorial on a blog that required MongoDB. It had instructions on downloading and configuring the service. But for some reason the command for starting the Windows service in that tutorial wasn’t working. So I went to the MongoDB docs and tried running this command as listed in the mongodb.org-

    The command for strting mongodb service- sc.exe create MongoDB binPath= "\"C:\MongoDB\bin\mongod.exe\" --service --config=\"C:\MongoDB\bin\mongodb\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"

    I got this message: [SC] CreateService SUCCESS

    Then I ran this one: net start MongoDB

    And got this message:

    The service is not responding to the control function.
    
    More help is available by typing NET HELPMSG 2186.
    

    I create a file named 'mongod.cfg' in the 'C:\MongoDB\bin\mongodb\' As soon as I added that file and re-ran the command- 'net start MongoDB', the service started running fine.

    Hope this helps.

提交回复
热议问题