mongodb的安装

mongodb 2019消息,不再开源,因此只能安装社区版本

brew tap mongodb/brew
brew install mongodb-community

To have launchd start mongodb/brew/mongodb-community now and restart at login:
brew services start mongodb/brew/mongodb-community
Or, if you don't want/need a background service you can just run:
mongod --config /usr/local/etc/mongod.conf

配置文件

/usr/local/etc/mongod.conf

启动服务端

brew services start mongodb/brew/mongodb-community
mongod --config /usr/local/etc/mongod.conf

启动客户端

mongo

常见命令:
show dbs;
use admin;
关闭服务
db.shutdownServer();

参考

https://github.com/mongodb/homebrew-brew
https://juejin.im/post/5d9d7ad66fb9a04e373163c3
https://www.runoob.com/mongodb/mongodb-osx-install.html

上一篇:Mongo--04 Mongo分片集群


下一篇:Mac启动MongoDB报错:exception in initAndListen: NonExistentPath: Data directory /data/db not found., term