一、下载
MongoDB 提供了可用于 32 位和 64 位系统的预编译二进制包,你可以从MongoDB官网下载安装,MongoDB 预编译二进制包下载地址:https://www.mongodb.com/download-center/community

二、安装
解压文件 ,在bin同级目录新建data文件夹

然后在data下新建子文件夹 db
MongoDB 将数据目录存储在 db 目录下。但是这个数据目录不会主动创建,我们在安装完成后需要创建它。
(一)部署(命令行启动)
进入bin目录,打开命令窗口

输入命令
mongod --dbpath ..\data\db
(二)部署(配置文件方式)
在bin同级目录新建conf文件夹,在conf文件夹内新建下图文件

根据自己的文件路径在mongod.conf里输入
storage:
dbPath: D:\work\mongodb-win32-x86_64-windows-4.4.4\data\db
然后在命令窗口输入命令
mongod -f ..\conf\mongod.conf

三、连接
(一)命令行

(二)图像化界面
在MongoDB官网下载https://www.mongodb.com/try/download/compass



切记 不要关闭前面启动好的MongoDB服务。不要关闭命令行界面。
网友评论