[英]mac: command not found: mongod
I installed mongodb by brew on my MacOS as the mongodb official documentation, but I tried to run MongoDB manually as a background process, use command "mongod --config /usr/local/etc/mongod.conf --fork".我在 MacOS 上通过 brew 安装了 mongodb 作为 mongodb 官方文档,但我尝试手动运行 MongoDB 作为后台进程,使用命令“mongod --config /usr/local/etc/mongod.conf --fork”。 Then the terminal displayed the message is : command not found: mongo.然后终端显示的消息是:找不到命令:mongo。
Did I miss any steps?我错过了任何步骤吗?
The above error appears when mongodb executable is not included in the PATH environment variable.当mongodb可执行文件未包含在PATH环境变量中时,会出现上述错误。
MongoDB gets installed to /usr/local/bin/mongod MongoDB 安装到/usr/local/bin/mongod
The command 'mongod --config /usr/local....' will work only if '/usr/local/bin' is included in PATH.命令 'mongod --config /usr/local....' 仅当 '/usr/local/bin' 包含在 PATH 中时才有效。
How to fix the problem?如何解决问题?
The problem can be fixed in 2 ways -问题可以通过两种方式解决 -
/usr/local/bin/mongod --config /usr/local/etc/mongod.conf --fork /usr/local/bin/mongod --config /usr/local/etc/mongod.conf --fork
export PATH=$PATH:/usr/local/bin导出 PATH=$PATH:/usr/local/bin
Run the above command or add the above line to the end of .zshrc file and .bash_profile file and execute mongodb command in a new terminal window .运行上面的命令或将上面的行添加到.zshrc文件和.bash_profile文件的末尾并在新的终端窗口中执行mongodb命令。
mongod --config /usr/local/etc/mongod.conf --fork mongod --config /usr/local/etc/mongod.conf --fork
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.