Windows 10 installation of MongoDB4.0 detailed process and startup configuration

1. Installation

First go to the official website to download the Mongodb installation package at https://www.mongodb.com/download-center/community   . After the download is complete, double-click to install it.

installation steps:

1. Click next

 

2. Check the lower left corner, click next

 

3. Select the default installation path, click completem; define the installation path yourself, click custom, click browse to select the path, click next

4. Click next directly

5. Uncheck the lower left corner and click next

6. Click install

7. Click ignore

8. Enter the MongoDB installation path, switch to the data directory, and create a new folder db under data

 

 9.windows+R, enter cmd to open the command line, switch to the MongoDB\bin directory, and execute the command mongod --dbpath C:\MongoDB\data\db

Reopen a command line and switch to the MongoDB\bin directory to execute the command mongo

 

 

 2. Automatic start

The above method has a drawback, the MongoDB server is started once every time it is used, and now it is changed to always start automatically.

step:

1. Right-click the computer, click properties, click advanced system settings, click environment variables, find path in user variables, click edit,

Add the path address of the bin directory to the end, so that mongo can be executed directly on any path on the computer

2.windows+R, enter services.msc, open the service, find MongoDB, which is automatically created during installation. Click Start, it will report an error;

windows+Q, enter cmd, right-click the command prompt, click Run as administrator, the command line will display the administrator;

Execute the command sc delete MongoDB, MongoDB status becomes disabled; switch to C:\MongoDB\data, create a new log folder;

执行命令 mongod --dbpath C:\MongoDB\data\db --logpath C:\MongoDB\data\log\mongo.log --install --serviceName MongoDB;

 Check the service, find the MongoDB service, right-click to start;

Open the command line, execute mongo, the connection is successful, and the operation can be performed;

You can also view 127.0.0.1:27017 through the browser

 

Guess you like

Origin blog.csdn.net/Tonylaoshi/article/details/112525437
Recommended