MongoDB 3.0 Windows Service Start:发生系统错误2 [英] MongoDB 3.0 Windows Service Start : System Error 2 has occured

查看:121
本文介绍了MongoDB 3.0 Windows Service Start:发生系统错误2的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我已经下载了MongoDB Windows msi安装程序并成功运行了该程序.

I have downloaded the MongoDB Windows msi install and run this successfully.

mongod.exe和mongo.exe命令文件执行正常.

The mongod.exe and mongo.exe command file executions work properly.

安装手册显示了如何创建配置文件,然后使用命令创建Windows Server

The installation manual shows how to create the configuration file, and then to create the Windows Server using the command

sc.exe create MongoDB binPath= "\"C:\mongodb\mongod.exe\" --service --config=\"C:\mongodb\mongod.cfg\""

这将创建SUCCESS响应.

This creates a SUCCESS response.

然后启动服务

net start MongoDB

但这会产生响应

System Error 2 has occurred.
The system cannot find the file specified.

对于需要此解决方案的人,解决方法是该手册指出mongod.exe的默认路径不正确,该路径应位于bin目录中

The resolution, for those who need this, is that the manual indicates the incorrect default path for mongod.exe, which should be in the bin directory

C:\mongodb\bin\mongod.exe

因此,尽管这是一个问题,但我也解决了这个问题,以使其他可能遇到此问题的人受益.

Thus, whereas this is a question, I have also solved this for the benefit of others who may have this problem.

此外,默认情况下,MongoDB将安装在Windows中的C:\ Program Files中,并且您应该使用自定义安装将其放入C:\ mongodb中.

Also, by default, MongoDB will install in C:\Program Files in Windows, and you should use the custom install to put it into C:\mongodb.

推荐答案

在安装之前,可能已经有一个名为"MongoDB"的服务,因此未成功安装.

It can be possible that you already have a service named "MongoDB" before your installation and thus it is not successfully installed.

尝试使用此命令删除上一个: "C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --remove

try to remove the previous one using this: "C:\Program Files\MongoDB\Server\3.4\bin\mongod.exe" --remove

,然后您可以尝试再次安装该服务并触发net start MongoDB命令.它现在应该可以工作了.

and then you can try install the service again and fire the net start MongoDB command. It should work now.

这篇关于MongoDB 3.0 Windows Service Start:发生系统错误2的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆