编程知识 cdmana.com

Latest mongodb configuration for Mac 2020

Mac 2020 newest mongodb To configure

Configure global environment variables

 Configure environment variables 
open -e .bash_profile
export PATH=${PATH}:/usr/local/MongoDB/bin
source .bash_profile
mongod -version //=>  Check whether the configuration is successful 

Configure database directory and log

  1. First of all, manually in mongodb Create under directory data/db and log/mongodb.log

  2. Configure data storage path and log file path

    sudo mkdir -p /usr/local/mongodb/data/db
    sudo mkdir -p /usr/local/mongodb/log
    
  3. Make sure the directory is readable and writable (xxx For your user name )

    sudo mkdir -p /usr/local/mongodb/data/db
    sudo chown xxx /usr/local/mongodb/log
    
  4. The background command starts mongodb

    mongod --dbpath /usr/local/mongodb/data/db --logpath /usr/local/mongodb/log/mongod.log --fork
    
    • –dbpath Set the data storage directory
    • –logpath Set the log storage directory
    • –fork Running in the background
  5. Open a terminal input mongo, Success means success
     Insert picture description here

Summary

Editing is not easy , Reprint please indicate the source . Thank you for reading , Looking forward to your suggestion , Praise and concern .

版权声明
本文为[D3qbz0a]所创,转载请带上原文链接,感谢

Scroll to Top