MySQL server not Starting, a usual MAMP headache

As many others WordPress developers out there, I use MAMP for local development.

I like the fact that is the faster and easier way to setup a low-maintenance development envi­ron­ment for OSX. Personally, I love setting up and using virtual hosts & WordPress multisite. That way I can work with loads of different projects in an organized manner.

The only problem I often get with this platform, is that MySQL won’t start. I hate when I resume my computer after sleeping a few hours, and I get that annoying red light just beside “MySQL server” indicator. Sometimes, it also happens when restarting your computer. And there it is, MySQL not starting.

There’s an easy solution for this, a quick and tiny fix you can run as many times you need. Simply killing all MySQL processes and then starting the servers again. Assuming that not many people hosts websites on OSX, you won’t have any collateral damage.

All you need to do, is run a simple command on the terminal or hyper.

killall -9 mysqld

This command will kill off the process. Then you’ll be able to start again your servers by hitting “Start Servers” in the MAMP app.

Note: Terminal is the terminal emulator included in Apple’s OS X operating system. You can find that app under Applications/Utilities. It’s basically a UNIX Shell. You can check if there are any MySQL processes running the “top” command. You can also use Hyper, a terminal app built by the amazing @rauchg and team.

Update – January 2017

If you are having trouble fixing this issue with the instructions above, many readers are being able to solve this problem thanks to the amazing fix shared by one of the commenters, ElCid. The instructions he shared are the following:

  1. Quit MAMP.
  2. In the finder go to Applications/MAMP/db/mysql/ and delete the last log file (look for a file named ib_logfileN – being N the log number). Please back up these before you delete them 🙂
  3. Restart MAMP.
  4. That’s it!

By Juanfra

Juanfra is a WordPress developer. He founded nicethemes.com, he loves food, traveling and music. He's hungry for more!

145 comments

  1. Hi

    Trying to use Mysql for the first time – “start servers” causes a grey spinning wheel to spin for about a second in the Mysql window, then nothing. And yet it says the Mysql server is “on” (green button). I don’t understand.

    The Terminal command “killall -9 mysqld” doesn’t work – it just gives the answer unknown-d4:9a:20:06:10:3a:~ xavierkreiss$

    I’m going mad.

    BTW I’ve uninstalled MAMP and reinstalled it – still no joy.

    Best wishes

    Xavier

    1. Hi Xavier,

      Thanks for writing. It sounds like mysql is not installed correctly through MAMP, or it is not starting. Is your MAMP phpmyadmin working?

      Best,
      Juanfra.

      1. Hi Juanfra

        Thanks for your answer. I’m proud to say that after deleting MAMP, reinstalling it,and re-launching it, I managed to make it work. And I’ve been able to understand a little about how both mysql and php work. But I haven’t been able to install Joomla properly, which is what I was trying to do. It’s definitely not for “non-techies” like me.

        But learning about MAMP has, at least, taught me something new, which might one day come in useful.

        Thanks again

        Xavier

    1. Hi Shovan,

      If it’s not your process, prepend sudo in order to run the command as administrator. That would be:

      sudo killall -9 mysqld

      It will ask for the administrator password. If you’re not the administrator, you may be out of luck 🙁

      Good luck,
      Juanfra.

  2. Hey Juanfra, I’m getting the same issue as Shovan. I tried the “sudo killall -9 mysqld” command, entered my password and it still returned “No matching processes belonging to you were found”

    Any other possible suggestions?

    I did just update my mamp yesterday and ever since then MySQL hasn’t been back online so that has to be part/all of the issue.

    Thanks!

  3. After some more research I found that apparently there are issues with Mac 10.8.3 and the newer version of MAMP running correctly. I’m guessing that’s the same issue Shovan is having. I went back to the MAMP site and downloaded the older MAMP (1.9.6.1) and everything worked perfectly again.

  4. Hi all, the solution is great but there are a few occasions where bizarrely even using SUDO will not close the process in terminal. I have no idea why this is however… If you do a search for ‘activity monitor’ and locate the mysqlld process and kill it that way you will then be able to resolve the issue. Truly hope that this helps anyone who is currently banging there head against the wall.

    Laters

    Regards

    Richard

    1. That’s really strange. SUDO should be killing the process.

      Another option would be checking the process id with top, ps or some other command and later kill the process with the process id as an argument.

      Thanks for writing!
      Cheers

  5. Thank you for this. it resolved it. But now most of my website is not showing. i see error messages like “Error displaying the error page: Application Instantiation Error”.
    Consequently i had upgraded y MAMP app before viewing my sites. Could the new MAMP be the problem. Few of my sites are view normally though. Any help?

    1. Thanks for writing. Well, it depends on the application that you’re using to run your website. The information on this post only does the trick when the mysql services is not starting.

  6. im a total newbie at all of this and your terminal command just save me hours of trying to figure out what i did wrong, thanks a million!

    1. Hello Dave,

      The whole idea is that the console asks for your password in order to execute the command. If the password is OK, then the command will be executed. Else, you should see an error message.

      Cheers.

  7. Thank you SO much Juanfra – one very scary moment then with no access to about 20 websites. I can only assume that I accidentally put the wrong password into MAMP and that crashed it.

  8. Hi Juanfra,

    I tried many solutions to the “mySQL Server not starting” but can’t get it back and now I can’t access to more than 10 websites on my Mac.
    When I type “sudo killall – 9 myslqd, it said “No matching process belonging to you were found”.

    Really appreciate if you can help! 🙁

  9. Hi,
    I have tried this(kiil all- terminal thing) but it shows ”No matching processes belonging to you were found”.
    I cant seem to start it any other way please help ,
    i tried deleting the files in the MAMP/db/mysql folder …mysql server starts after that but it shows me wordpress instalation page after that

    1. Please have in mind that you need to be literal with console commands. You quoted that you did the `kiil all- terminal thing`, when you had to type `killall -9 mysqld`. Now, erasing the whole mysql folder on your MAMP installation is a dangerous thing to do. For your specific case I’d reinstall MAMP, you might have lost a lot of configuration files + databases.

  10. Marios-iMac:~ marioamin$ killall -9 mysqld
    No matching processes belonging to you were found

    same here, thats what iam getting

    1. Have you tried with sudo? `sudo killall -9 mysqld`?

      If you get the same response check if there’s any mysql process at all with top (or vtop if you want, you’ll need to install it, but it feels and looks so much better).

      Cheers!

  11. Thank you for sharing your solution. Although it didn’t work for me, I explored a bit and something even easier did the job:
    1-Quit MAMP. 2- In the finder go to Applications/MAMP/db/mysql56/ and delete the last log file (in my case ib_logfile1). 3-Restart MAMP. Don’t ask me why but this solved the issue and now MySQL server is working! I hope this is helpful to others. Cheers.

    1. Wow thank you so much for this! I had tried all of the commands on the terminal and nothing solved it but this! (in my case it was ib_logfile0). PS I am running OS X El Capitan 10.11.6 and my SSD is not even nearly full.

    2. OMG THANK YOU this worked for me.
      I tried almost everything else under the sun, the mysql server did not want to start even though I did not have it running (couldn’t find any processes), I reinstalled MAMP and tried a bunch of other things people recommended, all to no avail, until; your suggestion!
      Thank you Thank you Thank you

    3. ElCid,
      Thank you so much!!! After fighting this all evening, and trying everything but reinstall… Your solution worked! 😀

    4. Hi ! I tried to do so and yes, MySQL started to work again.
      BUT ! All my database tables seem to be empty when I look in PHPMyAdmin ! So when I try to launch my WordPress websites, it asks me to install WordPress, assuming the site is empty… Any idea how to get my databases back ? Thanks in advance for your help !

    5. Hi, thank you, this way solved the my issue here, too. MAMP started again. it seems very simple and reasonable way.

  12. Forgot to say that I am running OS X Yosemite 10.10.5 on a MacBook Pro with an almost full SSD. Probably it was because of my lack of disk space that the log file got corrupted.

      1. I have tried any possible methods to start the MySQL server in mamp on my MacBook Air OX 10.10 Yosemite. Nothing happens…I deleted the log files in MySQL56 and restarted…nothing happens…what is the problem? M almost giving up on mamp..☹️☹️☹️

        1. Sorry to hear that! What files are the ones you erased? If you go to phpmyadmin do you get to see the db and table structures?

  13. You truly are a legend it worked. I went on my christmas holiday, i came back today and my deadline is tomorrow ive been all over stack overflow and other sites.

    Thanks for the help mate.

  14. Your post worked for me…”Quit MAMP. In the finder go to Applications/MAMP/db/mysql/ and delete the last log file (look for a file named ib_logfileN – being N the log number). Please back up these before you delete them
    Restart MAMP.”

    My Situation immediately prior to problem. Think my power cable to laptop shorted and computer shut down instantly. upon restart the sql server on MAMP did not register or start. Clearing the log file worked.

    Thanks

  15. Thank you millions! The updated version worked for me. Sooo simple and easy. I had to restart the whole computer, though, restarting MAMP was not enough.

  16. Firstly thanks for post!

    I just want to add that moving the ib_logfile* and auto.cnf elsewhere did not work for me even after restarting the computer. But moving the ibdata1 file elsewhere worked and by that I mean now MAMP can start MySQL server.

    However when I visit the wordpress site I had installed, I am prompted to reinstall WP.

    My environment: macOS Sierra 10.12.3, MAMP 4.1 (454), MySQL 5.6.34, Apache 2.4.23, PHP 7.10

  17. Thanks for this fix! Just a note for MAMP PRO users: I had to go to a different folder to find those logs files. For me they were located at Library/Application Support/appsolute/MAMP PRO/db/mysql56 . Once I found them and deleted both (0 and 1) – I was able to start SQL again.

    1. Thank you Brian! This worked for me! I kept deleting the files from the MAMP folder in Applications but I guess since I’m using MAMP Pro now it wasn’t enough.

      Thanks again!

  18. I deleted the last log file ib_logfile0 and keep ib_logfile1 there . Then I was able to start phymyadmin. however, i was not able to connect to My Website.
    Error: localhost is currently unable to handle this request.
    HTTP ERROR 500.

    Do you have any suggestions?

    if there a way we can open the ib_logfile0 and read it?. why remove the last log file ib_logfile could fix phpmyadmin not start problem? Is there a way we can manually fix the bad data in ib_logfile?

  19. Thanks your update about deleting the files from the folder worked a treat! Had been struggling following both a power failure and it simply refusing to start up again so I am now back up and running. Many thanks

  20. thank you so much for the 2017 update, the command in the terminal didn’t work, but deleting the logfile worked a treat!

  21. If you’re using Mac, the below should work, but only as a last resort especially if you use WP:

    rm /Applications/MAMP/db/mysql56/*

  22. Muchas gracias, Juanfra Aldasoro y ElCid.
    Hace tiempo estuve trabajando con una versión MAMP antigua, que desinstalé de mi MacOS. Para clonar una Moodle descargué Moodle4Mac-34.dmg que viene con la versión MAMP 4.1.1 pero como había cosas que no funcionaban tuve que quitarla. Cuando la volví a instalar observé que el archivo index.php del directorio htdocs indicaba su última línea ‘Something is wrong with your MAMP installation :-(‘ y al intentar conectar mediante phpMyAdmin con las bases de datos el navegador mostraba este mensaje:
    ‘Error
    MySQL ha dicho:Documentación
    #2002 – No such file or directory — El servidor no está respondiendo (o el zócalo local al servidor MySQL no está configurado correctamente).
    mysqli_real_connect(): (HY000/2002): No such file or directory
    Reintentar conexión’
    Buscando soluciones llegué a tu web 🙂 Probé tu solución primera sin éxito. Seguí a la segunda, pero en mi directorio Applications/MAMP/db/mysql/ no había ningún archivo llamado ib_logfileN sino una carpeta denominada mysql56 como indica ElCid en cuyo interior estaba el fichero ibdata1 de 79,7 MB que borré tras haber hecho copia de seguridad. Volví a iniciar MAMP y ¡problema solucionado!
    Muchísimas gracias a ambos.
    Un saludo cordial.
    Manuel Tito

Leave a comment

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