Cannot start MongoDB as a service

后端 未结 24 1497
情话喂你
情话喂你 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:34

    I ran this command:

    C:\MongoDB\Server\3.4\bin>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.

    After some trials and errors, I noticed when following the tutorial it asked me to name my file mongod.conf but the command was trying to refer to mongod.cfg.

    As soon as I corrected that name and re-run the commands,

    C:\MongoDB\Server\3.4\bin>sc.exe delete MongoDB
    [SC] DeleteService SUCCESS
    
    C:\MongoDB\Server\3.4\bin>sc.exe create MongoDB binPath= "\"C:\MongoDB\Server\3.4\bin\mongod.exe\" --service --config=\"C:\MongoDB\Server\3.4\mongod.cfg\"" DisplayName= "MongoDB" start= "auto"
    [SC] CreateService SUCCESS
    
    C:\MongoDB\Server\3.4\bin>net start MongoDB
    The MongoDB service is starting....
    The MongoDB service was started successfully.
    

    The service started running fine.

提交回复
热议问题