Solving the eternal struggle: MAMP won’t start MySQL in Windows

If you like me, are one of the many persons who has picked MAMP as your local server solution, you maybe have struggled more than once starting up MySQL from the MAMP (free) interface. One of the main reasons could be MySQL starting itself before being able to be launched via MAMP. So these are the steps you need to follow in order to shutdown the MySQL process in Windows and free the port, just make sure you are not running MAMP.

The easy way:

  • Open Start Menu and run the Resource Monitor (resmon.exe, not the Task Manager).
  • In the Resource monitor you can find mysqld.exe and kill it with the mighty power of your right click > End process.

The Hard Way:

  • Open Start Menu and run CMD as an administrator.
  • Once in the console run netstat -a -b.
  • Find the mysqld.exe process and take note of the PID (Process Identificator).
  • If you need to cancel the current netstat run or it’s taking too much, you can just Ctrl+C to cancel the current query.
  • Type kill /PID 00000-F and change the zeros with the PID you found earlier, -F is to force the process to be terminated.

When the process using the 3306 port exterminated, you can now just start again MAMP and even select the 3306 as your prefered again.

Things to consider:

  • The PID is not the Port number, but the process id.
  • This will not prevent the process to run the next time windows starts.

As soon as i find an easy way to avoid the port to be taked before MAMP i would write it. I wrote this article because i couldn’t found a solution in Stack Overflow for the Windows / MAMP / MySQL issue, so if is useful to you, enjoy!.