26 Jan 2009

If MAMP or OS X crashes, it can leave MAMP in a locked state where, when you restart it, it shows Apache and MySQL as running when they really are not. Clicking the Start/Stop Servers button will have no effect.

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.

Creative Commons LicenseThe 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.

Add Your Comment

Spam Protection by WP-SpamFree

Resetting a locked MAMP

  1. or change the port, then change it back again. works everytime.

    Rolle
  2. 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 :)

    Melvyn
  3. Thanks Aral.
    I have been reinstalling MAMP after OSX crashes. This will definitely save me some time.

    Todd Rothe
  4. 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!

    Frederik Jacques
  5. Awesome tip. Thanks for posting.

    Jason Campbell
  6. 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

    David Needham
  7. 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

    David Needham
  8. This was exactly what I needed to get my MAMP install to work again!

    Thanks!

    @David Needham
    My powerbook does the same thing!

    Dan Gayle
  9. 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’?

    bob
  10. 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

    Antony Wu
  11. 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).

    marco
  12. 2 years old, and still useful. Saved me an hour or so of head scratching. Thanks for posting this!

    Peter
  13. 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 :-)

    Ian
  14. Man, you just saved me with this.
    And more than 2 years after writing it! Kudos!

    Darius Kruythoff
  15. Brilliant tip, thanks for that!

    Jon Elliman
  16. 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!

    Sitebase
  17. 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.

    David Casillas
  18. YOU legend! I’ve been trying to fix this all day

    elixir
  19. Old but very usable article! Did the works, thanx!

    edwin
  20. Thank you! Saved my work day.

    zach
  21. thanx, dude! this made my day … keep it up!

    Jens Melander
  22. I’m getting everything described above but there is NO MySQL process running in top and no .pid file either. I’m completely baffled.

    Jake