To the MongoDB website to download MongoDB software: Mongodb-win32-x86_64-2008plus-ssl-3.0.2-signed.msi,
Put it where you want it installed:
such as: d:\MongoDB\
- 2
Click to install: Mongodb-win32-x86_64-2008plus-ssl-3.0.2-signed.msi
- 3
Agree to the agreement.
- 4
Custom installation.
- 5
Select Install in D:\MongoDB\
Then select the Installed components
- 6
Installation is complete.
- 7
Create Folders d:\mongodb\data\db, D:\mongodb\data\log, respectively, to install the DB and log files, create a log file under the log folder MongoDB.log, that is, d:\mongodb\data\log\ MongoDB.log
- 8
Run cmd.exe into the DOS command interface, execute the following command to start MongoDB
> CD D:\mongodb\bin
> D:\mongodb\bin>mongod-dbpath "D:\mongodb\data\db"
See the message that the start is successful, the default MongoDB listener port is 27017,mysql 3306
- 9
Test connection
Open a CMD window, enter the MongoDB bin directory, enter MONGO or Mongo.exe, the following message shows that the test passed, at this time we have entered the test database.
Enter exit or CTRL + C to exit.
- 10
When Mongod.exe is closed, Mongo.exe cannot connect to the database, so it is troublesome to open the Mongod.exe program every time you want to use the MongoDB database, so we can install MongoDB as a Windows service
Or run cmd, go to the Bin folder and execute the following command
> D:\mongodb\bin>mongod--dbpath "d:\mongodb\data\db"--logpath "D:\mongodb\data\log\MongoDB.log"--install-- ServiceName "MongoDB"
Here MongoDB.log is the log file that was started,--servicename the "MongoDB" service named MongoDB
Then start the MongoDB service
> D:\mongodb\bin>net START MongoDB
Shutting down services and deleting processes
> D:\mongodb\bin>net Stop MongoDB (Close service)
> D:\mongodb\bin>mongod--dbpath "d:\mongodb\data\db"--logpath "D:\mongodb\data\log\MongoDB.log"--remove-- ServiceName "MongoDB" (delete, note not--install)