MongoDB的安装步骤发生了变化

安装MongoDB

MongoDB 在 macOS 上的安装教程,可在 公式文档(https://docs.mongodb.com/manual/tutorial/install-mongodb-on-os-x/)中查阅。

由于MongoDB在brew中消失了,所以需要替代的步骤。
【前提】
MacOS
已安装Homebrew。

安裝Tap。

brew tap mongodb/brew

安装mongodb-community。

brew install mongodb-community
...
==> Summary
?  /usr/local/Cellar/mongodb-community/4.2.7: 21 files, 306.2MB, built in 4 seconds

日志文件和连接配置文件

/usr/local/etc/mongod.conf

命令

版本确认

mongod --version

在后台启动和停止

启动

brew services start mongodb-community

停下来 xià

brew services stop mongodb-community

确认进程

ps aux | grep -v grep | grep mongod

手动启动

如果要停止,请按 Ctrl+C。

mongod --config /usr/local/etc/mongod.conf

启动控制台

mongo

确认数据库

...
> show dbs
admin   0.000GB
config  0.000GB
local   0.000GB
bannerAds