Installing MongoDB under Windows is very simple. For a 32-bit operating system, install the 32-bit MongoDB, or 64-bit system to install the 64-bit MongoDB.
Here, take 64 bits as an example. The specific steps are:
First, download the latest MongoDB or newer version, here is the
Mongodb-win32-x86_64-2008plus-ssl-3.2.0-signed.msi
Second, installation
1 Double-click Mongodb-win32-x86_64-2008plus-ssl-3.2.0-signed.msi to start the Installation wizard interface. Choose "Next" button
2 acceptance of the agreement, Next
3 Complete installation path defaults to C:\Program Files\mongodb, if you want to customize the installation path, you should choose Custom.
Choose Custom Here
4 Change the installation location from the default C:\Program files\mongodb\server\3.2\ to
D:\Program files\mongodb\server\3.2\
Select "Next"
5 Select Install
6 Select Finish
Third, the creation of data file storage directory E:\db
Iv. Start MongoDB Service
Open the CMD console as an administrator and enter D:\Program Files\mongodb\server\3.2\bin
Execute Mongod.exe--dbpath=e:\db
As you can see from the last line, the default port used by MongoDB is 27017.
V. Random startup of MongoDB as a Windows service
1 Create log file to store directory D:\Program Files\mongodb\server\3.2\logs\
2 Installing System Services
Press CTRL + C to exit the Mongod process in the cmd window, and then execute the following command.
Mongod--dbpath=e:\db--logpath= "D:\Program files\mongodb\server\3.2\logs\mongodb.log"--install
Note that this step will be an error if the CMD window is not run as an administrator. In D:\Program Files\mongodb\server\3.2\logs\mongodb.log you can see the error "Error connecting to the Service Control Manager: Access Denied".
3 Open the Operating system's service window and discover that the MongoDB service has been successfully installed
4 Execute net start MongoDB to start MongoDB service
Vi. Client Connection
A new CMD window is opened and executed under D:\Program files\mongodb\server\3.2\bin Mongo.exe
Indicates that the connection to the test database was successful.
Vii. Setting the MONGODB environment variable
If you don't want to go into D:\Program files\mongodb\server\3.2\bin every time you connect to MongoDB, you need to D:\Program files\mongodb\server\3.2\ The bin is added to the path of the system.
Log off or restart after adding to allow the new environment variable to take effect. Enter the cmd window to verify
MongoDB Note 1:windows under Install MongoDB