Hello Friends,
In this video tutorial, you will learn how to install MongoDB on mac os x. I have explained the whole steps one by one in a very easy way for better clarification. Please watch the tutorial from the beginning for a better understanding.
All required download links and used commands are given below, please have a look:
Installation steps are:
Step 1: first download mongo DB server community edition from below link:
https://www.mongodb.com/download-cent...
Step 2: Extract the .tgz file somewhere on your mac machine.
Step 3: Now we need to create a root directory: data/db this will be used by the server to store data in it.
open terminal and type :
sudo mkdir -p /data/db // folder to store data
Step 4: now assign proper permission to read/write otherwise it will show you write error.
sudo chmod +x+r+w /data/db/
Step 5: Add mongodb/bin to $PATH; open bash_profile file and add path inside it.
to open type :- open ~/.bash_profile
entry :- export MONGO_PATH = mongodb folder path
export PATH = $PATH:$MONGO_PATH/bin
save file and close and restart terminal.
Step 6: verification :- type mongo -version
Step 7: Now we will start server: open terminal 1 and type:- sudo mongod
Note: how to stop mongo db server: open mongo shell then type following commands:
use admin
db.shutdownServer()
Step 8: Now open another terminal 2 and type mongo to launch a mongo shell to do work in mongodb:
Step 9: now we type some basic command on mongo shell:
DONE
#MongoDBInstallationMacOSX