Install MongoDB under Mac
1. Download mongodb-osx-x86_64-3.4.1.tgz and unzip the Https://www.mongodb.com/download-center on the MongoDB website.
2.
Enter the extracted bin directory
fengnovodemacbook-pro:~ fengnovo$ Cd/users/fengnovo/desktop/mongodb/mongodb-osx-x86_64-3.4.1/bin
Startup Mongod,mongod is the MONGO database server, MONGO is the MONGO database client
fengnovodemacbook-pro:~ fengnovo$ whoamifengnovofengnovodemacbook-pro:~ fengnovo$ sudo-spassword:bash-3.2# whoamirootbash-3.2#./mongod
And then we'll find a report of this mistake.
2016-12-24t22:54:24.079+0800 I STORAGE [Initandlisten] exception in initandlisten:29 Data directory/data/db not fou nd., terminating
The/data/db path is not, you can create a new path in the System files directory.
MKDIR/DATACD Datamkdir DB
Then try again./mongod, there is no such hint.
3. Open the console window and go to the bin directory just before opening the MONGO client
fengnovodemacbook-pro:~ fengnovo$ whoamifengnovofengnovodemacbook-pro:~ fengnovo$ sudo-spassword:bash-3.2# whoamirootbash-3.2#./mongo
Will find the Mongod Database Server window to print out the following information
2016-12-24t23:02:03.978+0800 I NETWORK [Thread1] connection accepted from 127.0.0.1:50977 #1 (1 connection now OPEN)
Description There is a database connection request to the MONGO database server
Next, you can happily do the application on MongoDB.
> Show dbsadmin 0.000GBlocal 0.000gb> dbtest
MongoDB Basic Tutorial can view http://www.runoob.com/mongodb/mongodb-connections.html
Install MongoDB under Mac