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();