Installation and configuration of MongoDB on Windows platform

  • 2020-06-15 10:25:54
  • OfStack

This article illustrates the installation and configuration of MongoDB on the Windows platform. To share for your reference, specific as follows:

Step 1 Download MongoDB

http://www.mongodb.org/downloads

Step 2

Unzip to the D:\mongodb\ directory and add D:\mongodb\bin to the system environment variable path for command line convenience.

Step 3

Create D:\mongodb\data\db and D:\mongodb\logs\ mongodb.log

Step 4 Start MongoDB

D:\mongodb\bin at the command prompt > mongod.exe --dbpath=d:\mongodb\data

Step 5 Install the WINDOWS service

Each D: \ mongodb \ bin > mongod. exe --dbpath=d:\mongodb\data It was too much trouble to start MongoDB, and it was much easier to install WINDOWS.

At the command prompt


D:\mongodb\bin>mongod.exe --logpath d:\mongodb\logs\mongodb.log --logappend
--dbpath d:\mongodb\data\db --directoryperdb --serviceName MongoDB --install

The command line specifies the log file: d:\mongodb\logs\ mongodb.log, with the log output appended.

Data file directory: d:\mongodb\data\db, with parameters --directoryperdb Indicate that each DB creates a new directory.

Name of Windows Service: MongoDB.

The above three parameters can be determined according to their own situation, you can check more parameters through mongod --help.

Finally, installation parameters: --install , as opposed to --remove .

Start the MongoDB:


net start MongoDB

Stop MongoDB:


net stop MongoDB

Delete service command:


sc delete  The service name 

Ok, start your MongoDB journey!!

I hope this article has been helpful to the MongoDB database programming.


Related articles: