How to stop mongo DB in one command

前端 未结 18 1248
小蘑菇
小蘑菇 2020-12-04 05:21

I need to be able to start/stop MongoDB on the cli. It is quite simple to start:

./mongod

But to stop mongo DB, I need to run open m

18条回答
  •  心在旅途
    2020-12-04 05:41

    Windows

    In PowerShell, it's: Stop-Service MongoDB

    Then to start it again: Start-Service MongoDB

    To verify whether it's started, run: net start | findstr MongoDB.

    Note: Above assumes MongoDB is registered as a service.

提交回复
热议问题