1)、在官网上下载MongoDB,
MongoDB官网: http://www.mongodb.org/
2)、"开始"->"运行"->"cmd"
Dos命令如下:
C:\Documents and Settings\v.sunyanjun>cd D:\mongodatabase\mongodb-win32-i386-1.8.2\bin\
C:\Documents and Settings\v.sunyanjun>d:
D:\mongodatabase\mongodb-win32-i386-1.8.2\bin>mongod --dbpath D:\mongodatabase\D
Bs --logpath D:\mongodatabase\DBs\logs\mongodb.log --install
all output going to: D:\mongodatabase\DBs\logs\mongodb.log
Creating service MongoDB.
Service creation successful.
Service can be started from the command line via 'net start "MongoDB"'.
此时MongoDB服务已经安装成功.
3)、看上面提示"Service can be started from the command line via 'net start "MongoDB"'.",若出现这个问题,删掉D:\mongodatabase\DBs\mongod.lock文件
再次启动服务,启动成功!
启动MongoDB:net start MongoDB
停止MongoDB:net stop MongoDB 注意:若在Windows7下,会报错如下:
Error connecting to the Service Control Manager: 鎷掔粷璁块棶銆?(5)
解决办法:
cmd.exe要以管理员的身份运行,再注册服务即可!