Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

How to install and configure mongoDB Database under mac system

2025-02-24 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

Shulou(Shulou.com)06/03 Report--

This article mainly shows you "how to install and configure the mongoDB database in the mac system", the content is easy to understand, clear, hope to help you solve your doubts, the following let the editor lead you to study and learn "how to install and configure the mongoDB database in the mac system" this article.

Download the official website of the installation of mongo database

MongoDB Chinese website windows users can refer to this installation method, which is more convenient, and mac users can refer to the following two ways

Install $brew update$ brew install mongodb using brew

Note: brew installs mongodb under / usr/local/Cellar/mongodb by default

Install using docker

Install the docker command

Brew cask install docker

Start docker

Docker network create somenetwork

Install mongo using docker

Docker run-d-- name mongo-- net somenetwork-p 27017 net somenetwork 27017 mongo

Note: it is recommended to use docker installation, so that you do not have to manually configure environment variables and modify configuration files, etc.

Configuration of mongoDB (required for brew installation) to set environment variables

Add mongodb/bin to $PATH, and enter mongod directly later. You don't need to enter it into the directory.

Export MONGO_PATH=/usr/local/Cellar/mongodb-community/4.2.3export PATH=$PATH:$MONGO_PATH/bin

The path is the path where mongodb is installed. You can replace it with your own.

Create a database storage directory

The default database for mongodb is / data/db, so we need to create it first

$cd / $mkdir-p data/db

Because the file may not be created after the mac system upgrade, the solution is as follows:

Step 1: turn off SIP system protection

1. Press and hold Command+R while rebooting the system to enter recovery mode (remember that it is when you reboot, not after boot)

two。 Click the utility toolbar at the top left of your computer and open the terminal

3. Execute the following command to turn off system SIP protection: csrutil disable

4. Restart the system after you have done it and enter normal mode

Step 2: after restarting the computer, open the terminal to execute

1. Check if csrutil status is disabled in the system integrity protection status

The display can be continued: System Integrity Protection status: disabled.

two。 Mount write permission successful sudo mount-uw /

Display input power-on password: Password:

3. Directory created successfully sudo mkdir / data/db

Step 3: add native permissions to / data/db $sudo chown-R xxx / data/db/ step 4: restart SIP system protection

It's important to pay attention to this step, because SIP is the last layer of guard on your computer, be sure to remember to start, start the command csrutil enable

Start the mongodb server

Start according to the default profile

Mongod-config / usr/local/etc/mongod.conf

If there is nothing wrong with the settings, you will see the following interface

The above is all the contents of the article "how to install and configure mongoDB database under mac system". Thank you for reading! I believe we all have a certain understanding, hope to share the content to help you, if you want to learn more knowledge, welcome to follow the industry information channel!

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Development

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report