Installing and configuring MongoDB under Mac

Source: Internet
Author: User
Tags mongodb download mongodb server

MongoDB download under the MAC installation is relatively simple, there are two main ways, one is to download the compression package decompression, the other is through the NPM or Homebrew command installation, here will not repeat,

The complex is the configuration of the MongoDB runtime environment (cannot start if the operating environment has not been configured, enter the Mongod command prompt ' is not a-a command ... ').

1, take the machine as an example, the use of compressed package to install the way:

Download the latest installation package from the MongoDB website, unzip it into the Documents/develop directory and write the name MongoDB,

2. Create a new two directory in the MongoDB directory:data/db--and storage data files, etc--for storing mongod.conf.
Use VI or another editor to create a mongod.conf file with the following content:

1 #mongodb config file 2 dbpath=/users/thomas/documents/mongodb/data/db/3 logpath=/users/thomas/documents/mongodb/ Mongod.log 4 true 5 27017 6 true 7 true

At this point the file directory structure is as follows:

3, modify the System environment variable path, add the /users/wangxi/documents/develop/mongodb/bin directory to the path.
There are many ways to modify environment variables, as follows:

First Add path:

Echo ' Export path=/users/wangxi/documents/develop/mongodb/bin: $PATH ' >>~/.bash_profile

As follows:

After adding, to make the environment variable effective, you can restart the shell terminal, or enter the command source . Bash_profile.

To see if the environment variable was added successfully:

Echo $PATH

As follows:

environment variable added successfully.

4. Start MongoDB

CMD+T Create a new command window, go to MongoDB's "bin" directory, use the command "./mongod" or "mongod" to start MongoDB server, the last line after successful startup should be the port number, as follows:

Create a new window, enter ./mongo or Mongo , and try to manipulate the database:

At this point, MongoDB has been installed and configured to complete. Yes!

Reference: http://jingyan.baidu.com/article/6fb756ecbfe474241858fb3b.html

Http://www.html5jq.com/fe/angular_node/20141218/24.html

Installing and configuring MongoDB under Mac

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.