1.添加環境變量 D:\mongodb\bin 2.啓動 mongod --path d:\mongodb\db --port=27000 3.設置配置文件 D:\mongodb\bin\mongodb.conf(這個名字不能改,不然呵呵) #數據庫目錄 dbpathdd:\mongodb\db #日誌目錄 logpath=D:\mongodb\log\mongo.log #日誌寫出 logappend=true #是否受權 noauth=true #默認端口 port=27001 #這個選項能夠過濾掉一些無用的日誌信息,若須要調試使用請設置爲false quiet=true 啓動 mongod -f D:\mongodb\bin\mongodb.conf 安裝爲服務: sc create MongoDB binPath= "D:\MongoDB\bin\mongod.exe --service --config=D:\MongoDB\bin\mongodb.conf" 啓動服務 net start MongoDB 【進階】添加爲自動啓動的服務 net stop MongoDB&sc create MongoDB binPath= "D:\MongoDB\bin\mongod.exe --service --config=D:\MongoDB\bin\mongodb.conf" start= auto&net start MongoDB [噓,當心,等號和值之間有個空格,否則就呵呵]