Mac using the Install MongoDB

Source: Internet
Author: User
Tags brew install mongodb install mongodb

1. Installation
Method 1:mac The computer is easy to install, directly download the required version of the decompression can:

Download URL

Https://www.mongodb.com/download-center?jmp=nav#community

Method 2:

Brew Install MongoDB

2. MongoDB data default exists/data/db, so need to create this folder

$ sudo mkdir-p/data/db #data with bin sibling

$ sudo chown xxx/data/db (sudo chown alan/data/db) # Set permissions with directory

Please replace XXX with your current user name, if you are unsure you can run $ whoami first

3. Set Environment variables:

Export Mongo_path=/usr/local/mongodb  # According to the directory you have placed export path= $PATH: $MONGO _path/bin  

4. Start MongoDB

$ mongod

5. Query Database

run in another terminal window

$ MONGO

You can then start various database directives, such as

$show DBS shows databases that already exist

$use somedbname Create (use) a database

6. Exit

$exit

Oruse admin

db.shutdownServer();

Mac using the Install MongoDB

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.