Mongod: Command Not Found (OS X)

前端 未结 9 970
情深已故
情深已故 2020-12-14 17:08

I am trying to test MongoDB and I have it all downloaded and moved into the root folder. I can navigate to the folder that holds the mongod, but when I try to run it by typi

相关标签:
9条回答
  • 2020-12-14 17:54

    In root directory

    sudo mkdir data
    cd data 
    mkdir db
    

    then

    sudo chown -R yourUsername /data/ 
    

    copy path of your mongodb/bin downloaded folder (I suggest you put it in home folder not root dir)

    in terminal

    export PATH="paste the link here :$PATH"

    now it should work but if not

    In case you are using different Unix shell and trying to execute mongod within visual studio code( for example ), make sure to read the documentation to link PATH.

    For example, if you are using zsh create .zprofile in your home directory.

    touch .zprofile

    copy your previously made PATH into .zprofile

    Now everything should work as expected.

    0 讨论(0)
  • 2020-12-14 17:56

    I was trying to install a previous version (3.6) using latest documentation (4.2 is already released). So, they now call it mongodb-community@3.6.

    In order to update PATH for such setup, the statement should be

    export PATH="$PATH:/usr/local/opt/mongodb-community@3.6/bin";
    

    I got hint from @retroGiant 's answer

    0 讨论(0)
  • 2020-12-14 17:57

    "Mongod" isn't a stand-alone command. You need to run the command like this:

    ./mongodb/bin/mongod
    

    I used this webpage to help me answer this question.

    0 讨论(0)
提交回复
热议问题