Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
menu search
person
Welcome To Ask or Share your Answers For Others

Categories

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 typing "mongod" into my terminal, I get a message that says:

"mongod: command not found"

See Question&Answers more detail:os

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
999 views
Welcome To Ask or Share your Answers For Others

1 Answer

Both answers above are correct. You can either specify the path in one of the following files: .profile, .bashrc, or .bash_profile

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

then call the daemon or the shell directly

mongod
mongo

Or for the commands not in the $PATH, use ./mongo or ./mongod from the directory containing these files. This solution can be verbose has you will have to eventually append the whole path when calling these commands from another directory.

/usr/local/mongodb/bin/mongod
or
/usr/local/mongodb/bin$ ./mongod 

与恶龙缠斗过久,自身亦成为恶龙;凝视深渊过久,深渊将回以凝视…
thumb_up_alt 0 like thumb_down_alt 0 dislike
Welcome to ShenZhenJia Knowledge Sharing Community for programmer and developer-Open, Learning and Share
...