MAC installation and configuration MongoDB

**

1.

** First enter the official website https://www.mongodb.com/download-center/community

The even version of mongoDB is the stable version and the odd version is the development version. Choose the version you want to install.
Insert picture description here
**

2.

** After
successful download, unzip the file to the / usr / local / directory, and rename the decompressed folder to MongoDB
ps: enter the / usr / local / directory available shortcut keys: shift+command+g
Insert picture description here
Insert picture description here
open the terminal and enter the open -e .bash_profile
configuration environment variable to the following Enter the path to bash_profile

export PATH="/usr/local/MongoDB/bin:$PATH"

Insert picture description here
Insert picture description here
stored command + s
is then input in the terminal source .bash_profile
and enter a carriage return after mongod -version
the figure below MongoDB then the version number has been successfully installed on the Mac
Insert picture description here
**

3

**
Create a data folder, and not automatically generated MongoDB installed, need to manually create
input terminal sudo mkdir -p /data/db
below a data folder will
Insert picture description here
open the input terminalmongo
Insert picture description here

Open the browser, enter localhost: 27017, this line of text will appear

It looks like you are trying to access MongoDB over HTTP on the native driver port.

Insert picture description here

The interface above shows the connection is successful startup!

If there is a connection failure exception: connect failederror
First method: check / data / db folder location right, not to re-create a
second method: Enter the terminal brew services start mongodbafter the transport inputmongo

Close the connection,

use admin;

db.shutdownServer();
Published 41 original articles · Likes2 · Visits 1836

Guess you like

Origin blog.csdn.net/weixin_43883485/article/details/104534533