mac intel chip 'zsh: command not found: mysql' after install through brew

It is complicate situation

  1. I installed mysql@5.7 through brew
  2. zsh can’t find mysql command. so, I add mysql path to ~/.zprofile
  3. but still zsh can’t find mysql, in addition can’t find brew
  4. if I remove mysql path, then zsh can find brew but not myqsl

this is my ~/.zprofile

# Added by Toolbox App
export PATH="$PATH:/Users/{username}/Library/Application Support/JetBrains/Toolbox/scripts"

export MVN=${HOME}/Library/apache-maven-3.8.6
export PATH=$PATH:${MVN}/bin

export PATH="$PATH:/Users/{username}/Library/Python/3.9/lib/python/site-packages"
export PATH="$PATH:/Users/{username}/Library/Python/3.9/bin"
export PATH="$PATH:/usr/local/sbin"

export PATH="$PATH/usr/local/Homebrew/bin"
export PATH=“$PATH/usr/local/opt/mysql@5.7/bin”

With both mysql and brew line -> can’t use both brew and mysql

If I remove mysql line -> can use brew but not mysql

If I remove both mysql and brew line -> can use brew but not mysql

ls /usr/local/opt with grep ‘mysql’ then

$> ls -al /usr/local/opt | grep mysql
lrwxr-xr-x   1 {username}  admin    24 10 12 11:05 mysql -> ../Cellar/mysql/8.0.30_1
lrwxr-xr-x   1 {username}  admin    26 10 15 15:01 mysql@5.7 -> ../Cellar/mysql@5.7/5.7.39
lrwxr-xr-x   1 {username}  admin    24 10 12 11:05 mysql@8.0 -> ../Cellar/mysql/8.0.30_1

And I also checked mysql command is not found after installing using homebrew.

but I cant figure out the cause

please help

>Solution :

When adding elements to path, do not forget to put in the : separator. What you’ve done is just smashed this on the end, effectively fusing it to whatever unfortunate entry was last in the list.


export PATH="$PATH:/usr/local/opt/mysql@5.7/bin"

Also there’s "smart quotes" in your code, which could be an issue. Those are not interpreted as quotes, but as part of the path.

When editing files like this, be sure to use a code editor and not a word processor. Word processors will substitute the quotes to make things look nice, but this will confuse the shell.

Leave a Reply