I cant get my mysql to start on os x 10.7. It is located in /usr/local/mysql/bin/mysql
I get command not found when I type mysql --version
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.
With MAMP
I installed MAMP and phpmyadmin was working.
But cannot find /usr/local/bin/mysql
This fixed it
sudo ln -s /Applications/MAMP/Library/bin/mysql /usr/local/bin/mysql
Add the following lines in bash_profile:
alias startmysql='sudo /usr/local/mysql/support-files/mysql.server start'
alias stopmysql='sudo /usr/local/mysql/support-files/mysql.server stop'
and save the bash_profile.
Now, in the terminal start and stop the mysql server using the following commands:
startmysql //to start mysql server
and
stopmysql //to stop mysql server
May be i will help out some of you that even though if you are unable to open mysql from terminal after trying changing path in .bash_profile
then you always found the error "MYSQL not found" hence you can use the following command directly it will ask for your password and sql bash is opened
/usr/local/mysql/bin/mysql -u root -p
in terminal do:
vi ~/.bash_profile
And add this line:
export PATH=${PATH}:/usr/local/mysql/bin
and the type this in terminal:
mysql -u [username] -p [password]