mongodb installation under mac

Install MongoDB under Mac

First, use a browser or a third-party tool to download
the download address of the current version: http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.6.tgz

Or the second, open a terminal and use the following command line to download:

curl http://downloads.mongodb.org/osx/mongodb-osx-x86_64-2.4.6.tgz > mongodb.tgz

After the installation is successful, the “mongod”command starts the mongodatabase. Enter http://127.0.0.1:28017 in the browser.  If mongothe database information can be displayed normally, it means the startup is successful.

The interface after success:

installation steps

1. First enter in the terminal ls, list the directory, find your mongodbfile, tgzend with

2. Open the terminal and enter tar -zxvf mongodb-osx-x86_64-2.4.6, of course, the respective version numbers are correct.

3. Move the unzipped installation files to your preferred location:

mv -n ~/Downloads/mongodb-osx-x86_64-2.4.6 ~/Applications/mongodb/

My decompression directory is , the folder Downloadsmoved to by default is invisibleApplicationsmongodb

4. Create a directory under the root directory /   data/db for placing mongodbdata and set permissions for the directory

sudo mkdir -p /data/db
sudo chown -R  trigkit4 /data

5. Start the mongodb service

Open the terminal, type cd Applications/mongodb/bin, press Enter, and then type./mongod

6. Open another terminal, enter Applications/mongodb/bin, enter, enter ./mongo

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326403764&siteId=291194637