因閒着無聊所以在window8 上安裝mongodb玩玩。
安裝的都是最新版本:mongodb:mongodb-win32-x86_64-2.4.3
一、 首先安裝mongodb
①將下載的包解壓到一個目錄
D:\DB
②從cmd中進入你所在的目錄
③在這個目錄下創建兩個文件夾 data和logs
④然後進入到bin目錄,在這裏輸入命令:mongod --dbpath=D:\DB\mongodb-win32-x86_64-2.4.3\data
此步驟不要關閉dos窗口
⑤在瀏覽器中輸入http://localhost:27017/
如果出現
You are trying to access MongoDB on the native driver port. For http diagnostic access, add 1000 to the port number
表示安裝成功。mongodb默認端口號是27017
⑥然後在mongodb的目錄下輸入
mongod --logpath D:\DB\mongodb-win32-x86_64-2.4.3\logs\MongoDB.log --logappend --dbpath D:\DB\mongodb-win32-x86_64-2.4.3\data --directoryperdb --serviceName MongoDB --install
此步驟是將mongodb作爲一個服務
⑦然後就可以使用 net start MongoDB 命令啓動mongodb了