1. Download
First download on the official website ( https://www.mongodb.com/download-center/community ) mongodb installation version, open the page as shown in the picture: I choose the version 4.2.5 .
2. Installation
After the download is complete, double-click mongodb-win32-x86_64-2012plus-4.2.5-signed.msi
3. Installation path
Select Complete and install to the default path.
Select Custom and install to a custom path, such as mine: D: \ mongodb
Click next (the picture is downloaded online, too lazy to install again after installation)
Continue to click next
Note: (The picture is downloaded online, too lazy to install again after installation)
4. Configure mongodb.config under the directory structure after installation
mongodb.config
#Database path
dbpath=D:\mongodb\data\db
#Log output file path
logpath=D:\mongodb\log\mongod.log
#The error log uses append mode
logappend=true
#Enable log files, enabled by default
journal=true
#Filter out useless log information, if you need to debug use, please set to false
quiet=true
#The port number defaults to 27017
port=27017
After configuration, it is:
5. Start the server
Run the cmd command window as an administrator: enter D: \ mongodb \ bin
Run the following command:
mongod --dbpath D:\mongodb\data\db --logpath=D:\mongodb\log\mongodb.log --logappend --install --serviceName "MongoDB"
Enter http://127.0.0.1:27017/ or http: // localhost: 27017 / in the browser, and the following interface will appear:
At this time, you can go to check the service. You can see that MongoDB is running, indicating that the windows service of mongodb has been started successfully.
Run the cmd command window as an administrator , connect to the server, you can see the details of MongDB
6. Configure environment variables
At present, we can only run commands in the MongoDB installation directory, and we cannot run command-line tools in other directories.
Open the windows settings window, enter and edit the system environment variables, and click. Select the environment variable and add the bin directory of mongodb in the path
In this way, we can run in other directories
This is the end of the steps to install MongoDB on window10. Friends who have problems, please leave a message! ! !