MongoDB service startup problem solving

Preface

The reason why this happened was because I did not pay attention to the path when installing MongoDB, so MongoDB installed the bin directory to the default path for me, that is, it was separated. Like in the past, I must have deleted and reinstalled it all together, hahaha, but things are different now, look at me directly cutting it!

 

text

First - [Transfer files]

To pull the bin directory and other files in the default path back to the custom path, you need to stop the service first and go directly to the service item in the task manager to stop:

Two ways to stop windows services

  1. Find the service stopped in task manager
  2.  win+R --> cmd --> services.msc

Then move and delete the default folder , which is the first step.

Step 2 - [Restart service]

The steps to restart the service are as follows

  1. Go to the bin directory in the custom directory and open cmd as an administrator (it must be opened as an administrator, otherwise you will get an error!)
  2. Remove the original MongoDB service and delete the two files mongod.lock and storage.bson in the data directory.
mongod.exe --remove  --serviceName "MongoDB"

     3. Enter the command and start the service (if it does not take effect, you can open the MongoDB service project in the task manager and open it manually)

//安装服务
mongod.exe --logpath C:\Software\mongoDB\Server\6.0\log\mongod.log --logappend --dbpath C:\Software\mongoDB\Server\6.0\data --directoryperdb --serviceName MongoDB --install

//启动服务
net start MongoDB

Message

This is a passage I saw recently:

All efforts will not be immediate, but all laziness will be deafening every moment.

Reference article

MongoDB installation and service startup icon-default.png?t=N6B9http://t.csdn.cn/mAcxr Starting mongodb service in windows environment - Cang Qinglang - Blog Park (cnblogs.com) icon-default.png?t=N6B9https://www.cnblogs.com/cangqinglang/p/10839486 .html


During this process you may need

Guess you like

Origin blog.csdn.net/Ccc67ol/article/details/132088518