Merle
Merle

Reputation: 129

mysql command not found in bash

On my mac, if I type mysql --version in bash, the bash shows that command not found.

$ 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/[email protected]/bin/mysql  Ver 14.14 Distrib 5.5.62, for osx10.14 (x86_64) using  EditLine wrapper

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

I add the mysql bin directory to my PATH variable in my .bashrc. I don't know what is going on.

Upvotes: 0

Views: 1631

Answers (2)

Inesa Toroyan
Inesa Toroyan

Reputation: 31

You need to add mysql to your env. Based on what are you using (standard bash or zsh or other), you need to open the configuration file such as

~/.zshrc or ~/.bash_profile and add there the following

export PATH = "${PATH}/etc/local/mysql/bin"

Do not forget to do to apply the changes

source ~/.zshrc

Upvotes: 0

Eyal
Eyal

Reputation: 1709

The issue is with the backslash (\) in the PATH env:

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

After removing it:

/usr/local/opt/[email protected]/bin

Upvotes: 2

Related Questions