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:
- Quit MAMP
- Open Terminal (Applications/Utilities/Terminal.app)
- Type “killall -9 mysqld” (without the quotes)
- 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).
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???
Hey tried it for a second time and it connected to the database with no errors!!!!!!!!! Thanks!!!!!!!!
Thanks! it worked perfectly..
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. : )
Merci! Enfin, quelque chose qui fonctionne!
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 ?
this doesn’t work for me
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.
thanks! awesome! this worked for me!
Thnak you so much, its working now !
Thanks – worked a treat. I LUV you already!!!
Thank you! it works !
Wow thanks for this it’s working now!
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.
O tak pjn to kompletna porazka!
Many thanks, works perfectly!!!
Thanks…It worked……Very helpful…
thank you!
Thanks! “killall -9 mysqld” worked for me!
Working fine. thanks lot
Worked for me on first try (with sudo), thanks!