MongoDB更改默认端口并重新启动服务

时间:2020-04-10 06:13:13

标签: windows mongodb

我是MongoDB开发环境的新手,因为我首先使用Windows。

我试图在MongoDB上设置端口首选项,所以我在 mongod.cfg

上编辑端口号
# network interfaces
net:
  port: 8888
  bindIp: 127.0.0.1

然后我进行了一些研究,它说我需要重新启动mongo数据库。 通过输入: enter image description here

但是我有点困惑在哪里键入此命令,我应该打开另一个新的命令提示符吗?

1 个答案:

答案 0 :(得分:0)

命令sudo ...是Linux命令。在Windows中,您可以在Windows服务管理器中启动/停止服务。

您可以通过命令services.msc或通过“此PC鼠标右键 ->管理->服务”

您也可以从命令行启动/停止:

net stop MongoDB
net start MongoDB

MongoDB是默认服务名称,您可以在配置文件中设置

processManagement:
   windowsService:
      serviceName: <string>
      displayName: <string>
      description: <string>
相关问题