MongoDB安装配置

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
[嘘,小心,等号和值之间有个空格,不然就呵呵]
posted @ 2019-06-14 10:41  未来,为我而来!  阅读(155)  评论(0编辑  收藏  举报