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
安裝mongdb
C:\mongodb\bin>mongod --dbpath C:\mongodb\data --logpath C:\mongodb\logs\mongodb
.log --install
all output going to: C:\mongodb\logs\mongodb.log
啟動mangodb資料庫:
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
表示成功了