zsh:找不到命令:mysql
声明:本页面是StackOverFlow热门问题的中英对照翻译,遵循CC BY-SA 4.0协议,如果您需要使用它,必须同样遵循CC BY-SA许可,注明原文地址和作者信息,同时你必须将它归于原作者(不是我):StackOverFlow
原文地址: http://stackoverflow.com/questions/35858052/
Warning: these are provided under cc-by-sa 4.0 license. You are free to use/share it, But you must attribute it to the original authors (not me):
StackOverFlow
zsh: command not found: mysql
提问by Aniruddha
Trying to use MySQL for rails app and downloaded it from dev.mysql.com.
尝试将 MySQL 用于 rails 应用程序并从 dev.mysql.com 下载。
After successfully installing the package and seeing the option to start and stop the server from Preference Pane, if I go ahead and execute following command in my terminal
成功安装软件包并从首选项窗格中看到启动和停止服务器的选项后,如果我继续在终端中执行以下命令
mysql --version
I end up with error as -
我最终出现错误 -
zsh: command not found: mysql
I've been looking for this error and understand that this has something to do with my $PATH
variable and if display the value by echo $PATH
I get following output -
我一直在寻找这个错误并理解这与我的$PATH
变量有关,如果通过echo $PATH
我得到以下输出来显示值-
/Library/Frameworks/Python.framework/Versions/3.4/bin:/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.2.1/bin:/Users/aniruddhabarapatre1/.rvm/gems/ruby-2.2.1@global/bin:/Users/aniruddhabarapatre1/.rvm/rubies/ruby-2.2.1/bin:/usr/local/bin:/Users/aniruddhabarapatre1/bin:/usr/local/bin:/usr/bin:/bin:/usr/sbin:/sbin:/opt/X11/bin:/usr/local/git/bin:/opt/ImageMagick/bin:/usr/local/MacGPG2/bin:/Users/aniruddhabarapatre1/.rvm/bin
How do I resolve this error to get Mysql up and running.
如何解决此错误以启动并运行 Mysql。
采纳答案by Aniruddha
This was supposed to be a problem within my configuration and $PATH
variable. I followed mysql on mactutorial to resolve this.
这应该是我的配置和$PATH
变量中的问题。我按照mac上的mysql教程来解决这个问题。
In my terminal opened up configuration by going to vi ~/.zshrc
. Located line for export PATH="..."
and appended :/usr/local/mysql/bin
to it.
在我的终端中,通过转到vi ~/.zshrc
. 位于export PATH="..."
并附:/usr/local/mysql/bin
加到它的行。
Above procedure resolved my issue.
以上程序解决了我的问题。
回答by rust
You should try paste this line to your environment variables
您应该尝试将此行粘贴到您的环境变量中
export PATH=${PATH}:/usr/local/mysql/bin/
Then try restart your environment variables with the following command
然后尝试使用以下命令重新启动环境变量
source ~/.zshrc #If you use Oh-My-Zsh
source ~/.bashrc #If you use Default Bash
回答by hui zhao
On the latest MacOs Catalina.I hava tried to do above to sole this problem;
在最新的 MacOs Catalina.I hava 尝试做以上来解决这个问题;
vi ~/.zshrc // open the zsh config and edite
export PATH=${PATH}:/usr/local/mysql/bin/ // to add these words
source ~/.zshrc // make it work
Reopen a teminal and run mysql -u root -p
,input the password then you can login your mysql;
重新打开终端运行mysql -u root -p
,输入密码即可登录mysql;
回答by ?улио Цесар
On MacOs Catalina Open a terminal and run.
在 MacOs Catalina 打开终端并运行。
sudo nano /etc/paths
Added to end of file
添加到文件末尾
/usr/local/mysql/bin
Save the changes and quit. Reloaded terminal. Open a new terminal and run.
保存更改并退出。重装终端。打开一个新终端并运行。
mysql -u root -p
Its works for me.!!
它对我有用。!!