22

My Mysql server on MAMP won't start. This is the error:

161224 00:15:00 mysqld_safe Logging to '/Applications/MAMP/logs/mysql_error_log.err'. 161224 00:15:00 mysqld_safe Starting mysqld daemon with databases from /Applications/MAMP/db/mysql56 161224 00:15:01 mysqld_safe mysqld from pid file /Applications/MAMP/tmp/mysql/mysql.pid ended

I already tried the following commands:

> ps aux | grep mysql
> lsof -i
> sudo killall -9 mysqld

But the server is still not working.

Help ?

A R
  • 1,412
  • 2
  • 14
  • 29
Inas
  • 223
  • 1
  • 2
  • 5
  • [this](http://stackoverflow.com/questions/4145182/mamp-mysql-wont-turn-on) and [this](http://stackoverflow.com/questions/39953913/mamp-mysql-wont-start)? – Aᴍɪʀ Dec 24 '16 at 00:33
  • `Logging to '/Applications/MAMP/logs/mysql_error_log.err'` ← find anything here? – Michael - sqlbot Dec 24 '16 at 03:39

7 Answers7

106

Remove the files ib_logfileN (N being the number) from the MAMP/db/mysql56 folder.

Then restart MAMP.

Should Work!!

Edit: If the above step doesn't work completely, please remove the ibdata<n> file as well, based on the comments.

A R
  • 1,412
  • 2
  • 14
  • 29
  • 3
    This worked for me, I had two log files to delete. `ib_logfile1` and `ib_logfile2` also, I killed all the sql processes that were running in the background. `ps -ax | grep 'sql'` and then `kill 12345` where `12345` is the id associated with the respective process. also, in my particular case, my folder was just named `MAMP/db/mysql` not `mysql156` – RobBenz Apr 12 '17 at 12:43
  • 1
    You have to get rid of the ibdata file too - it wouldn't work unless I deleted that along with the other two noted above – Devin McQueeney Apr 26 '17 at 12:32
  • This got my MySQL server running - now just need to find out how to get Apache one to start now! I had to remove ibdata too. – Giles Apr 29 '17 at 16:14
  • 3
    Works like a charm. Thanks mate! – Siyah May 03 '17 at 16:48
  • 5
    Workkkkss! If on a Mac and using MAMP PRO the path to find these little devils is: `/Library/Application Support/appsolute/MAMP PRO/db/mysql56` – Jason Aug 03 '17 at 12:23
  • 4
    Works! BUT WHY? – OuuGiii Aug 10 '17 at 13:46
  • As Devin mentioned, I had to delete the ibdata file too. – skhan Feb 20 '18 at 03:55
  • 2
    this cause another issue for me, it says "table doesn't exist" but they are visible. :( https://stackoverflow.com/questions/7759170/mysql-table-doesnt-exist-but-it-does-or-it-should?page=1&tab=votes#tab-top – 4givN Mar 12 '18 at 16:02
  • BE VERY CARFEUL with this technique - I followed this advice moving files ``ib_logfile1``, ``ib_logfile2`` and ``ibdata1`` - which didn't help restart mysql server. I got it going again by switching to default PORTS (8888, etc) and back again to 80 and 3306. When it was going again, I was back to a brand new wordpress install. (!!!) After a few hair-raising moments I restored my old versions of ``ib_logfile1``, ``ib_logfile2`` and ``ibdata1`` - forced reset of PORT numbers again, and phew, my wordpress site was back in all its glory... – Mr_P Jun 03 '20 at 14:54
12

I am working on oS-X (Mac), I was wondering around and came to see this post which help me a lot.
Many readers are being able to solve this problem thanks to the amazing here are the step to fix it out--

This issue generally occur due to explicitly closing of MAMP serves.

  1. Quit MAMP.
  2. In the finder go to Applications/MAMP/db/mysql/
  3. Delete the last log file (look for a file named ib_logfileN – being N the log number Eg-ib_logfile0 and ib_logfile1) we can see in below image.

enter image description here

  1. Please back up these before you delete them.
  2. Restart MAMP.

It Worked for me, hope will work for you too..

S.Yadav
  • 4,273
  • 3
  • 37
  • 44
4

I killed the process mysqlid via Activity Monitor on MacOS and restarted MAMP and MySql run successfully.

Update: Even this solution works without restarting MAMP.

zeeawan
  • 6,667
  • 2
  • 50
  • 56
2

My MAMPs MySQL stopped working after a power failure, this worked for me:

  1. Stop servers from terminal

    • cd /Applications/MAMP/bin
    • ./stop.sh
  2. Create my.cnf file in /Applications/MAMP/conf with the following: [mysqld] innodb_force_recovery = 1

  3. Start MySQL from same terminal window.

    • ./startMysql.sh
  4. Stop MySQL once it has recovered (Check the log in /Applications/MAMP/logs/mysql_error_log.err).

    • ./stopMysql.sh
  5. Remove the lines from my.cnf, save and start the servers as usual from the MAMP app.

AEQ
  • 1,339
  • 1
  • 16
  • 20
2

MAMP is so touchy. Here's what worked for me:

cd /Applications/MAMP

Move or rename: mv tmp tmp_OLD.

Recreate the folder and a subfolder: mkdir tmp; mkdir tmp/mysql

Now start mysql from MAMP. I think it's possible the socket lock file (tmp/mysql/mysql.sock.lock) gets corrupted and needs to be regenerated.

Soulriser
  • 419
  • 8
  • 16
  • After trying everything else, THIS was the trick that did it for me! Thank you so much! macOS Big Sur 11.0 Beta with MAMP 5.7 – Oliver Aug 30 '20 at 09:56
  • Tested on MAMP PRO v6.6.4 (Build 34007 Intel) When other idea failed. This was the solution. i renamed the mysql folder in the temp directory and re-open MAMP PRO – Homezonic Jun 09 '23 at 11:26
0

In some cases it may possible that the MySQL is already running on 3306 port. So, you can change the port number with 3307.

P.S: If you are bound to use 3306 in that case I think you can stop existing MySql server and let MAMP to do it for you.

imbond
  • 2,030
  • 1
  • 20
  • 22
0

I tried everything but I don't know why I didn't find this solution yet.

  1. Quit Mamp
  2. Go To /Application/Mamp/tmp/mysql
  3. Delete File mysql.sock.lock
  4. Start Mamp Server and that's all

+1 if this answer is helpful :)

Mr Talha
  • 705
  • 7
  • 13