mongodb配置数据库文件夹,创建服务

配置步骤

1、新建data文件夹,并在data下创建db及log文件夹

2、在mongodb安装目录下新增mongod.cfg文件,配置如下

systemLog:
    destination: file
    path: D:mongodbdatalogmongod.log
storage:
    dbPath: D:mongodbdatadb

3、创建MongoDB服务

sc.exe create MongoDB binPath= ""D:Program Files (x86)MongoDBServer3.2inmongod.exe" --service --config="D:Program Files (x86)MongoDBServer3.2mongod.cfg"" DisplayName= "MongoDB" start= "auto"

4、启动MongoDB服务

net start MongoDB

原文地址:https://www.cnblogs.com/ZengYunChun/p/9810255.html