1、先去http://www.mongodb.org/downloads 下载
这里使用的是2.0.7,xp系统,
在c盘新建文件夹mongodb,下载后解压到这里(可自定义位置),在mongodb文件夹里新建data,logs文件夹,data为数据库存储位置,logs为日志文件存储位置。logs下新建mongodb.log
【配好环境变量C:\mongodb\bin】
进入cmd:
C:\Documents and Settings\Administrator>cd C:\mongodb\bin
C:\mongodb\bin>mongod --dbpath C:\mongodb\data --logpath C:\mongodb\logs\mongodb
.log --install
all output going to: C:\mongodb\logs\mongodb.log
C:\mongodb\bin>mongod --dbpath C:\mongodb\data
Mon Sep 10 09:29:55
Mon Sep 10 09:29:55 warning: 32-bit servers don't have journaling enabled by def
ault. Please use --journal if you want durability.
Mon Sep 10 09:29:55
Mon Sep 10 09:29:55 [initandlisten] MongoDB starting : pid=4372 port=27017 dbpat
h=C:\mongodb\data 32-bit host=8SC3ZQDAFABDN6J
Mon Sep 10 09:29:55 [initandlisten]
Mon Sep 10 09:29:55 [initandlisten] ** NOTE: when using MongoDB 32 bit, you are
limited to about 2 gigabytes of data
Mon Sep 10 09:29:55 [initandlisten] ** see http://blog.mongodb.org/post/13
7788967/32-bit-limitations
Mon Sep 10 09:29:55 [initandlisten] ** with --journal, the limit is lower
Mon Sep 10 09:29:55 [initandlisten]
Mon Sep 10 09:29:55 [initandlisten] db version v2.0.7, pdfile version 4.5
Mon Sep 10 09:29:55 [initandlisten] git version: 875033920e8869d284f32119413543f
a475227bf
Mon Sep 10 09:29:55 [initandlisten] build info: windows sys.getwindowsversion(ma
jor=6, minor=0, build=6002, platform=2, service_pack='Service Pack 2') BOOST_LIB
_VERSION=1_42
Mon Sep 10 09:29:55 [initandlisten] options: { dbpath: "C:\mongodb\data" }
Mon Sep 10 09:29:55 [websvr] admin web console waiting for connections on port 2
8017
Mon Sep 10 09:29:55 [initandlisten] waiting for connections on port 27017
表示启动成功,端口默认为27017
浏览器输入:http://localhost:27017/
显示:
You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number
表示成功了