1. Download and install MongoDB
official website Download: https://blog.csdn.net/qq_41127332/article/details/80755595 , select the appropriate version to download. I chose is 3.6.11
Download good installation package mongodb-win32-x86_64-2008plus-ssl-3.6.11-signed.msi, except half-way to select Custom than Custom installation path, all the way until the next to complete the installation. I chose the installation path:
Installation progress, as shown below:
In the installation directory manually created data \ db directory and log directory, and create in the log directory mongo.log file:
data directory: C: \ MongoDB \ data \ db
log directory: C: \ MongoDB \ log
Run as administrator cmd, MongoDB started by cmd:
cd C: \ MongoDB \ bin # change to the bin directory
mongod --dbpath C: \ MongoDB \ data \ db # services start mongodb
enter in the browser http: // localhost: 27017 (27017 is mongodb port number) to see if the display the following information, if the following information is displayed instructions MongoDB has successfully started!
Then close the cmd, close the browser window, or behind the service will fail to start. .
Configuring MongoDB
in C: \ MongoDB new configuration file directory mongo.config , reads as follows:
dbpath = C: \ MongoDB \ Data
logpath=C:\MongoDB\log\mongo.log
Run as administrator cmd windows service configuration:
# Switch to the bin directory
cd C: \ MongoDB \ bin
# command to perform a Windows service, the service name is MongoDB
the mongod --config "C: \ MongoDB \ mongo.config" --install --serviceName "MongoDB"
View Windows service, found the name for the MongoDB service:
Startup and shutdown services:
# start the service
NET Start MongoDB
# close the service
net stop MongoDB
Add the Windows environment variables:
After adding a good Windows environment variables, input mongo MongoDB open interactive mode of data:
Original link: https: //blog.csdn.net/u014454538/article/details/88625708