Make MAMP Start MySQL When It Doesn’t Want To

I am using MAMP for local PHP development. It’s alright. It has a tendency to not want to cooperate sometimes. Like this morning. I loaded up MAMP and Apache started just fine but MySQL didn’t want to do anything.

If you are getting an error similar to “Error: Could not connect to MySQL server!”, rather than having to reinstall MAMP (which sometimes doesn’t work), here’s a fix:

  1. Quit MAMP
  2. Open Terminal (Applications/Utilities/Terminal.app)
  3. Type “killall -9 mysqld” (without the quotes)
  4. Start MAMP

It should be working now. If not, you may have to sudo the command (“sudo killall -9 mysqld”)

Another option is to go to Appliacations/MAMP/db/mysql/ and delete anything is is NOT a folder. I didn’t have to use this option so I can’t vouch for it myself. According to forum postings it works though.

[Edit May 5, 2012] Very, very late response to a couple of the comments. If this isn’t working for you, you may have to use sudo. In Terminal, type “sudo killall -9 mysqld” (without the quotes). This will allow you to kill the mysqld process with security privileges of another users (such as root).

21 Responses to Make MAMP Start MySQL When It Doesn’t Want To

  1. Cynthia says:

    Thanks it does work. Now i have to figure out how to fix the Database Error: Unable to connect to the Database: Could not connect to MySQL. Any ideas???

  2. Cynthia says:

    Hey tried it for a second time and it connected to the database with no errors!!!!!!!!! Thanks!!!!!!!!

  3. Toke says:

    Thanks! it worked perfectly..

  4. Carlene says:

    Thank you so much! This is a case where I was looking for the solution to this problem and found your site – and it so elegantly fixes it! Thanks for taking the time to help us all. Altruism like this is why the internet can frequently showcase the finest of human nature. : )

  5. Laurence Pilon says:

    Merci! Enfin, quelque chose qui fonctionne! :)

  6. Kyu says:

    Nice, thx a lot. That problem seem to occur quite frequently these lasts months. Personnaly It never happaned to me before that. Any known issues on latest version of Mamp ?

  7. brad says:

    this doesn’t work for me

  8. Uma says:

    I have seen several write ups of how to do this and yours was by far the most simple and elegant. Straightforward and no extra fluff. Thanks not only for sharing but also for not making the simplest thing more complicated.

  9. brent says:

    thanks! awesome! this worked for me!

  10. Can Yurdaer says:

    Thnak you so much, its working now !

  11. Jo Shaw says:

    Thanks – worked a treat. I LUV you already!!!

  12. Tony says:

    Thank you! it works !

  13. Gen says:

    Wow thanks for this it’s working now! :)

  14. Thank you!! Worked excellently for me – it was really frustrating. The Apache server would start no problem but for some mysterious reason MySQL wouldn’t start.

    Thank you! All sorted now.

  15. Bertex says:

    O tak pjn to kompletna porazka!

  16. Thijs Hendrikx says:

    Many thanks, works perfectly!!!

  17. Thanks…It worked……Very helpful…

  18. eliz says:

    thank you!

  19. Martina says:

    Thanks! “killall -9 mysqld” worked for me!

  20. prabhu (from channai) says:

    Working fine. thanks lot

  21. Stephan says:

    Worked for me on first try (with sudo), thanks!

Leave a Reply

Your email address will not be published. Required fields are marked *

You may use these HTML tags and attributes: <a href="" title=""> <abbr title=""> <acronym title=""> <b> <blockquote cite=""> <cite> <code> <del datetime=""> <em> <i> <q cite=""> <strike> <strong>