Install MongoDB on Mac and mongodb on mac

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

Install MongoDB on Mac and mongodb on mac

1. Install
Method 1: the installation on the Mac computer is very simple. download the required version and unzip it:

Download URL

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

Method 2:

Brew install mongodb

2. mongodb data exists in/data/db by default, so you need to create this folder

$Sudo mkdir-p/data/db # Same level of data and bin

$ Sudo chown xxx/data/db (sudo chown Alan/data/db) # Set permissions with Directories

Replace xxx with your current user name. If you are not sure, run $ whoami first.

3. Set environment variables:

Export _path =/usr/local/mongodb # based on your own directory export PATH = $ PATH: $ export _path/bin

4. Start mongodb

 

$ Mongod

5. query database

Run in another terminal window

$ Mongo

Then you can start various database commands, such

$ Show dbs show existing databases

$ Use somedbname create (use) A database

6. Exit

$ Exit

Oruse admin

db.shutdownServer();

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.