My mamp mysql server won\'t turn on. I tried executing /Applications/MAMP/bin/startMysql.sh but that gave me this error :
101110 05:50:31 mysqld_safe
There's another reason why this could be happening and I don't see anyone mentioning it, so I'll explain it in this answer.
When you reboot your computer, sometimes you force-close the apps and MAMP is not able to shutdown MySQL properly which leaves the socket file intact instead of MySQL removing it cleanly as part of its shutdown process. From what I understand (sources needed), MySQL used to make a socket file verification if it was forced to shutdown before, but it's not doing it anymore. Here's what you need to do:
killall -9 mysqld
in terminal, then press enter to execute the command. It will shut down all the leftover mysql instances running.Everything should be booting up and running fine now. If not or if you can't find the mysql.sock file, your issue could be another one mentioned in the other answers.
Another gotcha:
Check who is the owner of /Applications/MAMP/logs/mysql_error_log.err
On my machine, it is owned by admin: admin
.
/Applications/MAMP/bin/startMysql.sh
will fail to start, even if run with sudo.
But this will work:
sudo su admin
/Applications/MAMP/bin/startMysql.sh
With a new/clean install of MAMP 4.1.1, I had the same problem.
When running:
/Applications/MAMP/bin/startMysql.sh
MySql reported:
mysqld_safe error: log-error set to '/Applications/MAMP/logs/mysql_error_log.err', however file don't exists. Create writable for user 'mysql'.
.
So, I ran touch /Applications/MAMP/logs/mysql_error_log.err
and tried again with startMysql.sh
. It worked (but it wasn't quite "by itself")!
other way that might fix the same problem :
-go in the folder MAMP/db/mysql/ – delete all files that IS NOT A FOLDER (files like ‘mysql-bin.XXXXXX’ / ‘mysql-bin.index’/ ‘ibdata1’ / ‘ib_logfileX’
don’t worry, this doesn’t erase any of your database, but make sure you don’t delete the folders. That’s where the data of your databases are stored.
What I have found is that at times more than one occurrence of mysql is running. What I do when MySQL will not start is I first quit MAMP, then I go into the Applications/utlities and open the Activity Monitor. From there I search for "my" which should bring up any mysql's that may be running. I then either quit or force quit mysql. At that point I'm able to open MAMP with a working MySQL server.
Hope that helps.
twob.net has a pretty good fix for it. Go Into terminal and type in
killall -9 mysqld
Check it - http://twob.net/journal/fix-for-mamp-mysql/. Worked for me