Mac安装MongoDB

Mac安装开源软件一如既往的简单。

brew install mongodb

查看安装情况

brew info mongodb

monodb和其他服务一样,可以通过services管理

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

查看所有运行的服务

brew services list
brew start/stop mongodb

连接

$ mongo
MongoDB shell version v3.6.5
connecting to: mongodb://127.0.0.1:27017
MongoDB server version: 3.6.5
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-05-07T11:44:00.934+0800 I CONTROL  [initandlisten]
2019-05-07T11:44:00.934+0800 I CONTROL  [initandlisten] ** WARNING: Access control is not enabled for the database.
2019-05-07T11:44:00.934+0800 I CONTROL  [initandlisten] **          Read and write access to data and configuration is unrestricted.
2019-05-07T11:44:00.934+0800 I CONTROL  [initandlisten]
>

你可能感兴趣的:(Mac安装MongoDB)