MongoDB notes (1)-download and install

download

download link

https://fastdl.mongodb.org/osx/mongodb-macos-x86_64-4.2.3.tgz

Unzip

$ sudo tar -zvf mongodb-macos-x86_64-4.2.3.tgz

Renamed to mongodb, moved to / usr / local /, added to PATH

$ export PATH=/usr/local/mongodb/bin:$PATH

run

Create database storage directory / data / db

$ sudo mkdir -p /data/db

* sudo mkdir -p / data / db reported the Read-only file system, due
to Mac system upgrade Re-specify the custom database storage directory

$ sudo mongod --dbpath=/data/db 

* The command line should be re-specified every time the service is started

Start service

$ sudo mongod

Open the new terminal to execute the command:

$ ./mongo
MongoDB shell version v4.2.3
connecting to: mongodb://127.0.0.1:27017/?compressors=disabled&gssapiServiceName=mongodb
WARNING: No implicit session: Logical Sessions are only supported on server versions 3.6 and greater.
Implicit session: dummy session
MongoDB server version: 3.2.4
WARNING: shell and server versions do not match
Welcome to the MongoDB shell.
For interactive help, type "help".
For more comprehensive documentation, see
	http://docs.mongodb.org/
Questions? Try the support group
	http://groups.google.com/group/mongodb-user
Server has startup warnings: 
2020-03-22T15:54:23.861+0800 I CONTROL  [initandlisten] ** WARNING: You are running this process as the root user, which is not recommended.
2020-03-22T15:54:23.861+0800 I CONTROL  [initandlisten] 
> 1+1
2
>

Display the above information and input 1 + 1 and output 2 and the installation and operation are successful

Download and use visualization tools

download link

After setting Privacy Settings> close

Select Fill in connection fields individually> connect on the main interface

* Remember to start the service first

Published 91 original articles · Likes12 · Visits 170,000+

Guess you like

Origin blog.csdn.net/u012382791/article/details/105425450