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 [嘘,当心,等号和值之间有个空格,否则就呵呵]