Resetting a locked MAMP

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.

Comments