6.MongoDB4.0在Windows环境的下载、安装、配置
简单来说:MongoDB4.0在Windows下已经不需要再次配置db文件夹之类操作,安装完成直接进行连接测试即可,以下是具体过程(此前网上很多的教程都已经过时)
1.下载:https://www.mongodb.com/download-center/community?jmp=nav
下载下来的名字是:mongodb-win32-x86_64-2008plus-ssl-4.0.4-signed.msi
2.安装:一路确认,到第二步,点custom,自定义个目录
3.重新安装到此步时,用默认选项安装如图:
3.此处记得去掉勾,否则可能要很长时间都一直在执行安装(MongoDB Compass 是一个图形界面管理工具,我们可以在后面自己到官网下载安装,下载地址:https://www.mongodb.com/download-center/compass)
也可用:【Navicat Premium 12】来可视化编辑数据库
如果不小心勾选,直接用任务管理器结束进程,再次安装提示:Another installation for MongoDB。。。。。
可通过如下方法解决:
- 启动任务管理器
- 手动中断msi···exe进程 【大约3~4个这样的进程】,然后再安装即可正常安装
==========测试是否正常==========================================
1.到安装目录\bin下执行mongo.exe,进入mongo命令模式执行以下CMD命令,成功即可:
MongoDB shell version v4.0.4 connecting to: mongodb://127.0.0.1:27017 Implicit session: session { "id" : UUID("aaf1538e-24e1-4611-b14e-91f2ba0591bc") } MongoDB server version: 4.0.4 Welcome to the MongoDB shell. For interactive help, type "help". For more comprehensive documentation, see http://docs.mongodb.org/ Questions? Try the support group http://groups.google.com/group/mongodb-user Server has startup warnings: 2019-04-22T14:19:05.324+0800 I CONTROL [initandlisten] 2019-04-22T14:19:05.324+0800 I CONTROL [initandlisten] ** WARNING: Access contr ol is not enabled for the database. 2019-04-22T14:19:05.324+0800 I CONTROL [initandlisten] ** Read and wri te access to data and configuration is unrestricted. 2019-04-22T14:19:05.324+0800 I CONTROL [initandlisten] 2019-04-22T14:19:05.324+0800 I CONTROL [initandlisten] Hotfix KB2731284 or late r update is not installed, will zero-out data files. 2019-04-22T14:19:05.324+0800 I CONTROL [initandlisten] --- Enable MongoDB's free cloud-based monitoring service, which will then receive an d display metrics about your deployment (disk utilization, CPU, operation statistics, etc) . The monitoring data will be available on a MongoDB website with a unique URL acc essible to you and anyone you share the URL with. MongoDB may use this information to make prod uct improvements and to suggest MongoDB products and deployment options to you. To enable free monitoring, run the following command: db.enableFreeMonitoring() To permanently disable this reminder, run the following command: db.disableFreeM onitoring() --- > db test > show dbs admin 0.000GB config 0.000GB local 0.000GB >
视图效果:
2.服务状态查看:我的电脑——管理——服务
进入【服务】列表,找到MongoDB Server ,查看状态是否为正在运行
3.访问 Http://localhost:27017 显示如下即表示成功安装mongodb,并成功运行