1: Installation
Go to MongoDB's official website http://www.mongodb.org/downloads Download 32bit Package
The following files will appear after decompression
Under the installed disk C: Create a MongoDB folder, copy the bin folder to this directory, which is equivalent to the installation of MongoDB related commands.
In order to start MongoDB convenient, add Mongod.exe path to environment variable, computer----Advanced system settings--environment variable, add path in path:
This allows the Mongod command to be used anywhere in the command line.
2: Set up data file and start up
Then create a new MongoDB folder on the D drive to place the data file and create the Data,log folder under the MongoDB folder, and create the Mongodb.log file under the log folder.
Start MongoDB Service: Open command Line Input command
>mongod--dbpath "D://mongodb//data"--logpath "D://mongodb//log//mongodb.log"--logappend
The following behavior occurs when the 27017 port starts successfully.
Resolution: Mongod--dbpath command is to create a database file storage location, the start of the MongoDB service needs to determine the location of the database files, or the system will not be automatically created, startup will not be successful.
--logpath indicates that the log file is stored in a path--logappend means that the log file is written in an appended way
You will see this message on your browser:
The default port of 27017, you can also modify the port through the--port command, such as: Mongod--port 9888 "D:\\mongodb\\data"
3: Start by service mode
Each time you start the service you need to enter the above command, for convenience, you can write the startup database as a window service.
>mongod--logpath "D://mongodb//log//mongodb.log"--logappend--dbpath "D://mongodb//data"--directoryperdb-- ServiceName MongoDB--install
This only needs to enter the net start MongoDB at the command line can start the service, but do not know what reason, I set this, in the "service", also can't find MongoDB?
When you start cmd as an administrator instead, enter the command:
SC create MongoDB binpath= "C:\mongodb\bin\mongod.exe--service--dbpath D:\mongodb\data--logpath=d:\mongodb\log\ Mongodb.log--logappend--directoryperdb "
Delete Service directive: Mongod.exe--remove--servicename "MongoDB"
Note to start the command line by using administrator mode
So there's MongoDB service in the service.
In the process of tossing MongoDB service, found that the database service can not start, the box error: "Service does not respond or control function", tried a lot of other methods are no solution
Last execute SC delete mongodb force Delete MongoDB Service
Troubleshooting the installation of MongoDB Mongod command is not an internal or external command