Mysql command not found in OS X 10.7

One alternative way is creating soft link in /usr/local/bin

ln -s /usr/local/mysql/bin/mysql /usr/local/bin/mysql

But if you need other executables like mysqldump, you will need to create soft link for them.


This is the 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 search in need 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 open terminal put it in the file .bash_profile, which is run when Terminal opens.


If you installed MySQL Server and you still get

mysql -u root -p command not found

You're most likely experiencing this because you have an older mac version.

Try this:

in the home directory in terminal open -t .bash_profile

paste export PATH=${PATH}:/usr/local/mysql/bin/ inside and save it

instead of writing mysql -u root -p paste the following in your terminal:

/usr/local/mysql/bin/mysql -u root -p 

Or use Alias instead of writing the full path

alias mysql=/usr/local/mysql/bin/mysql

Enter your password. Now you're in.


I faced the same issue, and finally i got a solution. Please go through with the below steps, if you are using MAMP.

  1. Start MAMP or MAMP PRO
  2. Start the server
  3. Open Terminal (Applications -> Utilities)
  4. Type in: (one line) 
 /Applications/MAMP/Library/bin/mysql --host=localhost -uroot -proot

This works for me.

Tags:

Mysql