MongoDB|安装和运行

Abstract:Mac上MongoDB的安装和运行。

安装

用homebrew安装

1
2
3
brew update
brew install mongodb
brew install mongodb --with-openssl

运行

1.create the data repository:

1
sudo mkdir -p /data/db

2.run

1
2
3
4
5
6
7
8
9
10
11
//Run without specifying paths

mongod

//Specify the path of the mongod

<path to binary>/mongod

//Specify the path of the data directory

mongod --dbpath <path to data directory>

3.stop MongoDB

press Control+C in the terminal where the mongod instance is running.

Thanks!