Mysql command not found in OS X 10.7

610    Asked by Aryangupta in SQL Server , Asked on Jun 2, 2021

I can't get my MySQL to start on os x 10.7. It is located in /usr/local/mysql/bin/mysql.

I'm getting the command as not found when I execute mysql --version in the terminal.

I have also tried installing MySQL with the dmg and I have tried to install it through homebrew and I can't get it to work. When I tried to start mysql with homebrew, I'm just getting it as MySQL won't start.

To check, this is my $PATH:

/usr/bin:/bin:/usr/sbin:/sbin:/usr/local/bin:/usr/X11/bin:/usr/local/git/bin:/Users/Victoria/bin:/usr/local//usr/local/mysql/bin/private/var/mysql/private/var/mysql/bin
Answered by Danna sahi

This is a problem with your $PATH :

/usr/local//usr/local/mysql/bin/private/var/mysql/private/var/mysql/bin.

$PATH is where the shell searches for command files. Folders to look in got to be separated with a colon. And so you want /usr/local/mysql/bin/ in your path but instead it searches in /usr/local//usr/local/mysql/bin/private/var/mysql/private/var/mysql/bin , which probably doesn't exist.

Instead you want ${PATH}:/usr/local/mysql/bin .

 So do export PATH=${PATH}:/usr/local/mysql/bin.

If you want this to be run every time, you need to open terminal put it in the file .bash_profile , which is run when Terminal opens.

Note :

This error “mysql command not found mac” occur due to $PATH: /usr/local//usr/local/mysql/bin/private/var/mysql/private/var/mysql/bin .

 $PATH is where the shell searches for command files. If you want this to be run every time you open the terminal put it in the file .bash_profile.



Your Answer

Interviews

Parent Categories