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!

Comments

147 responses to “MySQL server not Starting, a usual MAMP headache”

  1. Xavier Kreiss Avatar
    Xavier Kreiss

    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. Juanfra Avatar
      Juanfra

      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. Xavier Kreiss Avatar
        Xavier Kreiss

        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. Juanfra Avatar
          Juanfra

          Hi Xavier,

          I’m happy to hear that 🙂 – I always recommend WordPress on top of others like Joomla or Drupal. You can download a copy from http://wordpress.org and have your site running in a few minutes. You can check more about installing WordPress here: http://codex.wordpress.org/Installing_WordPress

          Best,
          Juanfra.

        2. Jon Buckner Avatar
          Jon Buckner

          Hi Xavier

          I recently got Joomla working with MAMP

          The problem is due to a bug in Joomla.

          You have to change a bit of code form ‘true’ to ‘false’

          http://www.ostraining.com/support-forum/joomla-support/mamp-jommla-3-1-5-php-5-5-making-it-work/

          Though I realise this reply is a long time after your comment, I hope you have it working, so this is more for other people

          Excellent article JUANFRA

          Thanks very much

          1. Juanfra Avatar
            Juanfra

            Hey Jon,

            Thanks for sharing your experience, and thanks for your kind words 🙂

  2. Braindead Avatar
    Braindead

    You saved my hide today. Thanks!

    1. Juanfra Avatar
      Juanfra

      No worries 🙂

  3. Chris Avatar

    This worked. I had absolutely no idea – I thought I was going to have to reinstall or something. Thanks so much, Juanfra!

    1. Juanfra Avatar
      Juanfra

      No problem 🙂 Neither did I at first, and I had the same sensation! lol

  4. kimmm Avatar
    kimmm

    Worked! Thank you Jaunfra!

  5. Jenny Harle Avatar

    Thanks! This post saved me a headache.

  6. Shovan Sargunam Avatar

    Hi

    I tried it this is what I get

    No matching processes belonging to you were found

    Any suggestion?

    1. Juanfra Avatar
      Juanfra

      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.

  7. Will Cabral Avatar
    Will Cabral

    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!

  8. Will Cabral Avatar
    Will Cabral

    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.

    1. Juanfra Avatar
      Juanfra

      Thanks for sharing, Will 🙂

  9. kimmm Avatar
    kimmm

    Thank you for sharing this tip Juanfra! I have used it several times and it’s worked without fail.

  10. Ereeek Avatar
    Ereeek

    Mahalos for this! Back to work!

  11. Justin Avatar
    Justin

    Thanks, it’s totally worked for me.

  12. Ben Avatar

    Juan you are the man. Thanks for this quick tip.

  13. Kim Avatar
    Kim

    Thanks for the tip! Worked great

  14. Georgia Gibbs Avatar

    I just wanted to thank you for posting this. You saved me from a lot of frustration!

  15. Simon Avatar
    Simon

    Thanks saved me hours.

  16. Joe Avatar
    Joe

    So simple, yet so many people with this issue out there. Thanks! Keep it up

  17. Albin Avatar
    Albin

    Thanks! =B

  18. joey Avatar
    joey

    very helpful, thank you!

  19. Michael Avatar
    Michael

    THANKS! I was looking all over the place for just this.

  20. Usman Avatar
    Usman

    great solution. thanks

  21. Gabriel Avatar
    Gabriel

    You’re fucking awesome!

    Worked great!

    Thanks!

  22. Schurpf Avatar

    Thanks! Just worked 🙂

  23. Ann Avatar
    Ann

    thank you–it worked for me too.

  24. theclaw Avatar
    theclaw

    Great fix, worked like a charm for me !

    Thanks a lot

  25. Richard Deans Avatar

    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. Juanfra Avatar
      Juanfra

      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

  26. Víctor M. Martinez Valero Avatar

    This worked marvels for me too Juanfra, thank you for this post!

  27. Naser Avatar
    Naser

    Works great for me too!

    Thanks a lot!

  28. Kelly Avatar
    Kelly

    Thanks! Bookmarking this for next time.

  29. Peaceedotcom Avatar
    Peaceedotcom

    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. Juanfra Avatar
      Juanfra

      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.

  30. Jay Avatar
    Jay

    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!

  31. Ravi Avatar
    Ravi

    Thanks, it worked like a charm – running Mavericks on MacBook Pro 212

  32. Angel Avatar
    Angel

    This was perfect, thank you! 🙂

  33. Philip Harper Avatar

    Nifty trick,

    nice one!

  34. Rob Nichols Avatar
    Rob Nichols

    Cheers 😀

  35. William Sipling Avatar

    You sir, are the best. Thanks for posting this last year, it was helpful to me today!

  36. dave Avatar

    I can’t write when password comes up. Do I put the whole thing in Textwrangler or something like that?
    dave

    1. Juanfra Avatar
      Juanfra

      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.

  37. bloohair Avatar

    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.

  38. Alicia St Rose Avatar

    Thank you Jaunfra! This worked spendidly. You are my internet hero today!

    1. Juanfra Avatar
      Juanfra

      haha, no problem 🙂

  39. Rafael Trabasso Avatar

    Saved me today. MAMP was locked after I updated Mac OS X.

    Thanks a lot and warm cheers from Brazil.

    1. Juanfra Avatar
      Juanfra

      Obrigado Rafael! Abraço

  40. RJ Avatar
    RJ

    Thank you very much! This worked perfectly!

  41. Quynh Avatar
    Quynh

    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! 🙁

    1. Juanfra Avatar
      Juanfra

      Hi Quynh,
      Please check that you have a blank space between the dash and the 9, it should be `sudo killall -9 mysqld`

  42. Kristin Avatar
    Kristin

    Amazing. Thank you!

  43. Cheri Schappaugh Avatar
    Cheri Schappaugh

    Thank you this worked for OS X El Capitan update to version: 10.11.16.
    Many Thanks!!

  44. jude Avatar
    jude

    Yessssssss!!!!!! I’ve been fighting with this for 3 hours.

  45. Don Avatar
    Don

    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. Juanfra Avatar
      Juanfra

      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.

  46. marioamin Avatar
    marioamin

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

    same here, thats what iam getting

    1. Juanfra Avatar
      Juanfra

      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!

  47. ElCid Avatar
    ElCid

    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. Juliana Avatar
      Juliana

      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.

      1. Zedity Avatar

        Deleting the ib_logfile(s) solved the problem also on Sierra 10.12.2.
        Thanks

        1. Angela Avatar
          Angela

          Hi I also had to delete both of the log files but then it worked. Amazing tip! Thanks so much!!

    2. C.E Avatar
      C.E

      This also worked for me. Thank you very much!!

    3. Studio 108 Avatar
      Studio 108

      WOW a big thank you!! Deleting the ib_logfile1 file worked for me also.

    4. Iris Avatar
      Iris

      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

    5. Bradley Avatar

      Yes this was the only thing that worked for me also. I had to delete both 0 and 1. Thanks man I appreciate it!

    6. chapu Avatar
      chapu

      this worked for me thanks!!(in my case i deleted 2 files ib_logfile1, ib_logfile0)

    7. Lina Avatar
      Lina

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

    8. Rob Avatar
      Rob

      This worked for me. THANK YOU!

    9. Guillaume Avatar

      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 !

    10. Marcello Avatar
      Marcello

      nice one!

    11. mai Avatar
      mai

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

  48. ElCid Avatar
    ElCid

    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. Juanfra Avatar
      Juanfra

      Thanks for sharing! Cheers.

      1. Kuenzang Avatar
        Kuenzang

        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. Juanfra Avatar
          Juanfra

          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?

  49. nathan Avatar
    nathan

    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.

  50. […] the World Wide Web as I would, I came across a great article from Juanfra Aldasoro from Argentina on how to use terminal to quit any MySQL processes from running to get the server to reboot. […]

  51. Eduardo Oliveira Avatar

    Thank you! It worked! Great tip.

  52. Dolly\ Avatar
    Dolly\

    Life saver!!!!

  53. Daniel Avatar
    Daniel

    Thanks for the update. This worked like a charm. You ROCK!!!!!!!!!!!!!

  54. Dave Avatar

    Thank you so much!!!!!

  55. john dow Avatar
    john dow

    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

  56. Anu Avatar
    Anu

    Thank you so much! 🙂

  57. Lucas Avatar

    Woks perfectly, thanks!

  58. Ashok G Avatar

    Thanks Alsasoro. It worked with a charm. 🙂

  59. Frederick Avatar
    Frederick

    Thank you for the help!

  60. Nassor Avatar
    Nassor

    Thank you soooo much

  61. Milo Avatar
    Milo

    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.

  62. Patrick Avatar
    Patrick

    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

    1. Mairead Avatar
      Mairead

      Hi Patrick, I’m having the same issue. Did you find a solution?

  63. Denise Avatar
    Denise

    Thank you for the help!

  64. Danny Avatar

    Hi, that’s work!!!! thx.

  65. Mark Avatar
    Mark

    Thanks for the fix!

  66. ethiopians Avatar
    ethiopians

    Thanks so much, deleting the ib_logfile worked for me.

  67. Katelyn Avatar
    Katelyn

    Thank you! deleting the ib_logfile worked.

  68. Rakhi Avatar
    Rakhi

    Great tip. Thank you so much.

  69. Peter Avatar
    Peter

    Thanks, this solution worked! Solved me hours of research!

  70. David Pire Hernandez Avatar

    perfect thankss was worry i am new with macos jejeje delete the files log 0 y log 1 those two files and it works!!!

  71. Nicole Rhoads Avatar
    Nicole Rhoads

    Just wanted to say this worked for me today on Mamp 4.2 and OS Sierra. Thank you!!!

  72. Jusang You Avatar
    Jusang You

    wowowowo…You really saved my life.

  73. Brian Avatar
    Brian

    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. dan Avatar

      Thanks it was this exact update that broke me. Brian your comment narrowed it for me. Thanks bud.

    2. Juan Encalada Avatar
      Juan Encalada

      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!

      1. SKY1 - Livermore Web Design Avatar

        Thanks, this is what I was missing the whole time. I’m on MAMP Pro

        Tried all the other methods above for over an hour. Finally found your comment.

        Much appreciated!

  74. Faith Avatar
    Faith

    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?

    1. Faith Avatar
      Faith

      I changed the php version back to 5.6.27, then My Website was working.

      Thanks for the post. It save me hours!

  75. Kelvin Avatar

    Thank you guy, it worked like magic… I really Appreciate

  76. Nikita Avatar
    Nikita

    ‘Update – January 2017’ solution helped in my case. Thanks a lot!

  77. Catherine Pedersen Avatar
    Catherine Pedersen

    Killing all MYSQL processes worked! Thank you for your article. Very helpful Juanfra!

  78. Chatman Avatar
    Chatman

    Thanks for the tip!

  79. prakash Muniyappa Avatar
    prakash Muniyappa

    ‘Update – January 2017’ solution worked for me. Thanks a lot to you and ElCid!

  80. Jon Avatar

    Thank you so much. That fix from El CId fixed it for me!

  81. Alex Web Avatar

    glad I found your article I spent a lot of hours figuring out what to do. Thank you

  82. Vir Bhadra Yumnam Avatar

    Thank you Juanfra, it worked. I really Appreciate

  83. Mario Outten Avatar
    Mario Outten

    Thanks for the article. Solved the problem for me!

  84. craig O Avatar
    craig O

    You helped me my man, thanks very much!

  85. Schuyler Avatar
    Schuyler

    Worked like a charm. Thanks my friend!

  86. Adrianne Avatar

    Thanks! For the update fix for deleting last log file. Worked perfectly.

  87. Alex Avatar
    Alex

    Worked!! Thank you for the assistance!

  88. karthickeyan Avatar
    karthickeyan

    thanks, now worked after deleting the log files.

  89. Marloes Avatar
    Marloes

    Saved my day! Thank you!

  90. Jim Avatar

    Thank you for this — the log delete trick worked!

  91. Rob Avatar
    Rob

    Great fix thanks!

  92. Neil Oppegaard Avatar
    Neil Oppegaard

    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

  93. kristy Avatar
    kristy

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

  94. Kelsey Avatar
    Kelsey

    Worked perfectly. Thanks so much.

  95. Lehlohonolo Avatar

    Thank you, Problem sorted.

  96. MLipenkranz Avatar
    MLipenkranz

    The 2nd method worked for me! Thanks!

  97. Mangs Avatar
    Mangs

    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/*

  98. iyiuyiyu Avatar
    iyiuyiyu

    Works fine Thanks

  99. Andrea Avatar
    Andrea

    Oh my god. This post was a life saver! Thank you so much!

  100. HASAN HAYDAROV Avatar
    HASAN HAYDAROV

    THANK YOU JUANFRA, big thanks to you.

  101. […] stop already running MySQL server, please refer to this answer on StackOverflow and this blog […]

  102. Manuel Tito Martínez Peinado Avatar

    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

  103. […] The easiest solution: quit MAMP and remove the log files from MAMP/db/mysql directory [ib_logfile0, ib_logfile1] and restart MAMP. For more visit http://juanfra.me/2013/01/mysql-not-starting-mamp-fix/ […]

  104. […] La solución más fácil: salga de MAMP y elimine los archivos de registro del directorio MAMP/db/mysql [ib_logfile0, ib_logfile1] y reinicie MAMP. Para más visita http://juanfra.me/2013/01/mysql-no-arranca-mamp-fix/ […]

Leave a Reply

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