Windows下安装mongodb

 

 

1. Download MongoDB

2. Install MongoDB

3. Create the required folders:

"C:\MongoDB_2_6_Standard\bin\data\db"

"C:\MongoDB_2_6_Standard\logs"

"C:\MongoDB_2_6_Standard\etc"

NOTE: If the directories do not exist, mongod.exe will not start.

4. Create a simple configuration file:

systemLog:

destination: file

path: C:\MongoDB_2_6_Standard\logs\mongo.log

logAppend: true

net:

bindIp: 127.0.0.1

port: 27017

More info about how to create a configuration file:http://docs.mongodb.org/manual/reference/configuration-options/

5. Install MongoDB as a Windows Service (this way it will start automatically when you reboot your computer)

Run cmd with administrator privilegies, and enter the following commands:

"C:\MongoDB_2_6_Standard\bin\mongod.exe" --config "C:\MongoDB_2_6_Standard\etc\mongodb.conf" --dbpath c:\MongoDB_2_6_Standard\bin\data\db --directoryperdb --install

6. Start the MongoDB Windows Service

net start MongoDB

7. Connect to MongoDB via shell/cmd for testing

C:\MongoDB_2_6_Standard\bin\mongo.exe

NOTE: http://docs.mongodb.org/manual/tutorial/getting-started-with-the-mongo-shell/

8. That's it! You are done. :)

9. Uninstall/remove the MongoDB Windows Service (if you messed up something)

"C:\MongoDB_2_6_Standard\bin\mongod.exe" --remove

你可能感兴趣的:(windows)