This article records the steps I made to install MongoDB under the Win7 32 bit for recording.
First, download MongoDB
: https://www.mongodb.com/download-center#community
You can download the zip package or MSI installation file, and then unzip it and put it on the C:\MongoDB (you can choose the location)
Second, installation
Manually create a new database folder C:\MongoDB\data
Under C:\Windows\System32 cmd.exe, right mouse button, open as administrator (this step is important)
Follow the path to the Mongodb/bin directory
Input Mongod-dbpath c:\mongodb\data, set up database file automatically
Last line: Waiting for connections on port 27017, indicating a successful configuration
At this point in the browser address bar input: http://localhost:27017/, if the configuration is successful, the following page is displayed:
Here, MongoDB has been successfully installed.
Third, configure the environment variable nuclear installation Services
Configure environment variables, add;d: \mongodb\bin Configure environment variables, you can open cmd, run MONGO anywhere, no need to go into MongoDB bin directory to run
Create the log directory D:\MongoDB\log
In console input:mongod--dbpath c:\mongodb\data--logpath c:\mongodb\log\MongoDB.log--install--servicename "MongoDB"-- Journal
Then, enter:net start MongoDB, you can start the service.
At this point, turn on the computer service, you can see the MongoDB service.
MongoDB is installed and configured, ready to use.
Four, you can also configure the MongoDB configuration file, run the configuration to start MongoDB.
New Catalog c:\mongodb\etc\mongo.conf
#数据库路径
Dbpath=c:\mongodb\data\
#日志输出文件路径
Logpath=c:\mongodb\logs\mongodb.log
#错误日志采用追加模式, after configuring this option, the MongoDB log is appended to the existing log file instead of creating a new file
Logappend=true
#启用日志文件, enabled by default
Journal=true
#这个选项可以过滤掉一些无用的日志信息, set to False if you need to use Debug
Quiet=true
#端口号 defaults to 27017
port=27017
Last run:
1. Normal start-up
Mongod--config D:\MongoDB\etc\mongodb.conf
2. Install as a Windows service
Mongod--config D:\MongoDB\etc\mongodb.conf--install
3. Use SC Installation as Windows Service (SC is servicecreate abbreviation, also used to create service)
SC create MongoDB binpath= "D:\MongoDB\bin\mongod.exe--service--config=d:\mongodb\etc\mongodb.conf"
It is best to start the service via net start MongoDB.
Windows System Installation MongoDB