The problem is that MAMP stores the process ID of the running servers in .pid files inside the MAMP application bundle. If it crashes, it can't always remove these files. When it restarts, it finds the .pid files and thinks that the servers are running at the process IDs contained therein.
The fix is simple: for Apache, delete the httpd.pid file in MAMP/Library/logs/ and for MySQL, delete the mysql.pid file in MAMP/tmp/mysql/.
If MySQL still refuses to start up, check that the process isn't still running.
If this is the case, your mysql_error_log file in MAMP/Logs may show you errors similar to:
InnoDB: Unable to lock ./ibdata1, error: 35 InnoDB: Check that you do not already have another mysqld process InnoDB: using the same InnoDB data or log files.
Run: top and check to see if there is a mysqld process running. If there is, note its PID (e.g., 16320) and kill it:
kill -9 16320
Now, restart the servers in MAMP and everything should start working as before.
The Resetting a locked MAMP article by Aral Balkan, unless otherwise expressly stated, is licensed under a Creative Commons Attribution-Noncommercial 2.0 UK: England License.
or change the port, then change it back again. works everytime.
Had this a few times too…
But the solution is just as easy as go to “Settings…” then click on “OK” without even changing anything :)
Thanks Aral.
I have been reinstalling MAMP after OSX crashes. This will definitely save me some time.
Indeed, changing the port will do the same thing. I ran into this problem a few times and just started to adjust all the settings. Changing the port worked for me.
But finally I know what the real problem is! Thnx Aral!
Awesome tip. Thanks for posting.
Thanks! I’ve been having this problem for a long time and never been able to fix it until today thanks to you!
David Needham
http://www.enjoycreativity.com
Just as a FYI to help anyone else that happens across this post, I wrote a quick script based on this post to execute the deletion of those files in an instant. OS X regularly dies because my battery is zapped, so I was doing this a few times a week.
Enjoy! http://tr.im/AVY8
David Needham
http://www.enjoycreativity.com
This was exactly what I needed to get my MAMP install to work again!
Thanks!
@David Needham
My powerbook does the same thing!
I don’t understand the bit about checking if there is a mysqld process running.
what do you mean by “Run: top”??
what is ‘top’?
Thank you for great tip. I now have MySQL up and running now :)
Re: Bob, top is the command that displays a sorted list of running processes. You can find out more information about the command with
man top | less
thanks for the tips – my mashine started to act wierd and i had to force a restart (first time after two weeks or so). after this it seems mysql seemed to run in the background and i couldn’t start mamp. the tip of killing mysql did it for me (wouldn’t have noticed this because of why it would run after a restart).
2 years old, and still useful. Saved me an hour or so of head scratching. Thanks for posting this!
After years on the PC dark side I have recently moved over to OSX, and consequently am having to relearn everything. This short troubleshooting article has helped me as much as it has educated. By that I mean lots :-)
Man, you just saved me with this.
And more than 2 years after writing it! Kudos!
Brilliant tip, thanks for that!
Just had this problem too. A quick search gave me this article and in a few seconds I’m up and running again. Thanks for the help Aral!
Thanks, I could find the mysqld process in Monitor and kill it.
I’m having this issue since upgrading to Lion while never get it before in Leopard.
InnoDB: Unable to lock ./ibdata1, error: 35
InnoDB: Check that you do not already have another mysqld process
InnoDB: using the same InnoDB data or log files.
YOU legend! I’ve been trying to fix this all day