Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

zsh: command not found: mysql

People also ask

How do I fix MySQL not found Mac?

On macOS, you should be able to use mysql command once you installed MySQL using the official macOS installer or Homebrew. If you find the command not found error, then you need to manually add the bin/ folder to your . bashrc or . zshrc file if you use ZSH command line client.

How do I run MySQL on a Mac?

Open macOS system preferences and select the MySQL preference panel, and then execute Start MySQL Server. The Instances page includes an option to start or stop MySQL, and Initialize Database recreates the data/ directory.


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

On the latest MacOS Catalina. I have tried to do above to solve this problem;

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;


On MacOs Catalina Open a terminal and run.

 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.!!


This was supposed to be a problem within my configuration and $PATH variable. I followed mysql on mactutorial to resolve this.

In my terminal opened up configuration by going to vi ~/.zshrc. Located line for export PATH="..." and appended :/usr/local/mysql/bin to it.

Above procedure resolved my issue.


For my MacOS Catalina. I tried everything above, it didn't work. The code below worked for me. Thanks to this link https://www.youtube.com/watch?v=kijzRVw8eUQ. Input the code in your terminal.

/usr/local/mysql/bin/mysql -uroot -p

It worked also for MacOS big sur with ARM processor