在bash中找不到mysql命令

时间:2019-06-06 22:40:35

标签: mysql bash macos

在我的Mac上,如果我在bash中键入mysql --version,则bash显示未找到该命令。

$ echo $PATH
/Users/merle/.nvm/versions/node/v11.10.0/bin:/usr/local/opt/mysql\@5.5/bin:/Users/merle/Downloads/mongodb-osx-x86_64-4.0.4/bin:/Applications/PostgreSQL\ 10/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/Library/TeX/texbin:/opt/X11/bin:/Library/Frameworks/Mono.framework/Versions/Current/Commands

$ /usr/local/opt/mysql\@5.5/bin/mysql --version
/usr/local/opt/mysql@5.5/bin/mysql  Ver 14.14 Distrib 5.5.62, for osx10.14 (x86_64) using  EditLine wrapper

$ mysql --version
-bash: mysql: command not found

我将mysql bin目录添加到.bashrc中的PATH变量中。 我不知道发生了什么。

1 个答案:

答案 0 :(得分:2)

问题出在PATH环境中的反斜杠(\):

/usr/local/opt/mysql\@5.5/bin

删除后:

/usr/local/opt/mysql@5.5/bin