访问 https://www.mongodb.com/download-center,下载最新版本的 mongoDB,按照指引一步一步安装即可
需要创建一个配置文件,配置文件必须设置 systemLog.path 系统日志的路径
例如, 在 C:\Program Files\MongoDB\Server\3.6\mongod.cfg 创建一个配置文件,设置 systemLog.path 和 storage.dbPath:
- systemLog:
- destination: file
- path: c:\data\log\mongod.log
- storage:
- dbPath: c:\data\db
Install the MongoDB service by starting mongod.exe with the --install option and the -config option to specify the previously created configuration file.
安装 mongoDB 服务通过 "mongod.exe" 和 "--install" 选项 和 "--config" 选项来使用指定的配置文件安装。
例如:
- "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe"--config "C:\Program Files\MongoDB\Server\3.6\mongod.cfg"--install
如果需要的话,还可以安装多个实例 mongod.exe or mongos.exe, 但是要为每个服务一个独一无二的名字, --serviceName and --serviceDisplayName.
net start MongoDB
打开刚才的配置路径下的 log 文件,如果看到了下面的话 那么成功了!
- [initandlisten] waiting for connections on port 27017
通过 mongo.exe shell 链接
- "C:\Program Files\MongoDB\Server\3.6\bin\mongo.exe"
net stop MongoDB
- "C:\Program Files\MongoDB\Server\3.6\bin\mongod.exe"--remove
来源: http://www.bubuko.com/infodetail-2446816.html