50

My MAMP mysql server won't start. All of the suggestions I've seen on the web say to check for other mysqld processes running and kill them if they exist, and that it should fix the problem, but it has not for me.

Here's the error log:

130415 13:42:12 mysqld_safe Starting mysqld daemon with databases from /Library/Application Support/appsolute/MAMP PRO/db/mysql
130415 13:42:12 [Warning] Setting lower_case_table_names=2 because file system for /Library/Application Support/appsolute/MAMP PRO/db/mysql/ is case insensitive
130415 13:42:12 [Note] Plugin 'FEDERATED' is disabled.
130415 13:42:12 InnoDB: The InnoDB memory heap is disabled
130415 13:42:12 InnoDB: Mutexes and rw_locks use GCC atomic builtins
130415 13:42:12 InnoDB: Compressed tables use zlib 1.2.3
130415 13:42:12 InnoDB: Initializing buffer pool, size = 128.0M
130415 13:42:12 InnoDB: Completed initialization of buffer pool
130415 13:42:12 InnoDB: highest supported file format is Barracuda.
130415 13:42:13  InnoDB: Waiting for the background threads to start
130415 13:42:14 InnoDB: 1.1.8 started; log sequence number 1707549
130415 13:42:14 [Note] Event Scheduler: Loaded 0 events
130415 13:42:14 [Note] /Applications/MAMP/Library/bin/mysqld: ready for connections.
Version: '5.5.25'  socket: '/Applications/MAMP/tmp/mysql/mysql.sock'  port: 0  Source distribution

It looks like the connection is open to me, but MAMP stil errors out with this message: "MySQL wasn't able to start. Please check log for more information."

Any suggestions?

jordancooperman
  • 1,931
  • 2
  • 21
  • 33
  • I did eventually fix this problem, but unfortunately can't even remember how! Sorry about that @Christer, I'll post again if it comes back to me. – jordancooperman May 22 '13 at 14:00
  • Try this from official MAMP site: https://documentation.mamp.info/en/MAMP-PRO-Mac/FAQ/MySQL/MySQL-will-not-start/ This works for me :) – Kedar.Aitawdekar Mar 03 '21 at 10:15

28 Answers28

149

What worked for me was removing all files (but not directories) in the mysql dir.

Edit #2 As per answers below, you only need to delete the log files: [ib_logfile0, ib_logfile1]

So quit MAMP and then in the terminal:

rm /Applications/MAMP/db/mysql/ib_logfile* #(or wherever your MAMP is installed)

Edit!: A few people have mentioned that you may want to back up these files first in case anything goes wrong, so maybe just use mv instead:

mv /Applications/MAMP/db/mysql/*  /tmp/.

If this doesn't work go back and kill all processes: sudo killall -9 mysqld

This is also duplicated here: mysql server won't start MAMP

Manish Shrivastava
  • 30,617
  • 13
  • 97
  • 101
Eric Grotke
  • 4,651
  • 3
  • 21
  • 19
  • 4
    The rm /Applications/MAMP/db/mysql/* did the job! – loQ Nov 26 '15 at 03:32
  • 11
    Removing all the files not directories inside /Applications/MAMP/db/mysql56 did the job for me. Thanks for saving my time. – Jageet Mohan J Nov 24 '16 at 07:27
  • 2
    rm /Applications/MAMP/db/mysql56/* worked for me, as stated in prior comment this will remove the files, and leave the directories which worked. – Skelly1983 Dec 02 '16 at 01:24
  • 7
    Removing files made mysql start again; but my Wordpress site broke. And now in phpmyadmin it say that the "database has no table" and "No partitioning defined!" – Milad Dec 06 '16 at 09:18
  • I can confirm this is the solution when you upgrade to macOS Sierra. I also highly recommend making a backup before, luckily I had just one database, but for someone else, you can lose everything. – Robert Dec 19 '16 at 14:19
  • Yea removing files in that dir works. thanks man. but i recommend to backup the files in it before removing. – Muneef M Dec 29 '16 at 18:31
  • 1
    sudo killall -9 mysqld worked for me on MacOS and MAMP PRO 4. Thank you! – Michael Giovanni Pumo Jul 03 '17 at 11:16
  • 7
    This is a terrible suggestion. Without backing-up I deleted those files, now my Databases are showing empty tables. Way to go – October Eleven Nov 20 '17 at 17:56
  • Thank you! I just delete /Applications/MAMP/db/mysql56 's ib_logfile0 and ib_logfile1 – Byeongin Yoon Jan 22 '18 at 01:37
  • This worked beautifully for me. Make a backup of you log file just in case. Thank you! – theGrizz Feb 21 '18 at 19:26
  • We don't actually need to remove all our database(backing up or not), just the log files are ok to be deleted. – Orleando Dassi May 29 '18 at 14:08
  • in my case i deleted those files and mamp then downloaded Mysql version 5.7 for me and boom its working Thanks man. – MR_AMDEV May 18 '19 at 20:24
  • Removing both ib_logfile* and mysql-bin.* from MAMP/db/mysql made it come back up. Thanks for this! – Jos Jun 06 '19 at 07:09
  • i manually deleted the files (not directories) and it solved my problem i've been working on for 4 hours already – gorillagoat Mar 18 '22 at 16:45
88

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/

user3127648
  • 1,367
  • 12
  • 26
  • 2
    Brilliant! Thank you!! I deleted all the files in MAMP/db/mysql56 as suggested above and other places, but then every one of my WP sites wanted to reinstall. I restored all the files from TimeMachine, then deleted just the log files and viola! Success! – danzo Feb 17 '17 at 00:35
  • 8
    This works much better than clearing out all your tables. The accepted answer is destructive and not the right answer IMO. – Anriëtte Myburgh Feb 22 '17 at 08:46
  • 5
    This one works well. You don't have to delete all files inside mysql56. These two are enough. Thanks. – rekt0x Feb 24 '17 at 11:40
  • 1
    I removed the two files mentioned in this answer and as at today my MySQL started successfully. Brilliant! – Oluwatobi Samuel Omisakin Jul 13 '19 at 16:21
  • Please accept this answer @jordancooperman? The accepted answer is destructive. – Peter Højlund Palluth Feb 25 '21 at 15:36
32

Since none of the answers here solved my particular issue, I should probably add my own solution to to the list.

I had to hard reset my computer while MAMP was still running. This sometimes leads to a problem where, after restarting the machine, MAMP can start the Apache Server, but can not start the MySQL server for some reason.

My solution for this issue was to:

  • Close MAMP
  • Go to Applications/MAMP/tmp/mysql
  • delete the file mysql.sock.lock
  • Restart MAMP
ksav
  • 20,015
  • 6
  • 46
  • 66
  • 1
    This solution worked in my situation. Anyone has an idea why `mysql.sock.lock` needs to be deleted? – Carl H Mar 04 '20 at 02:20
  • 1
    needs more upvotes for sure, in my MAMP version 5.5 that's the only thing that fixed the problem. Appreciate it! – Robert Sinclair May 07 '20 at 08:12
  • 1
    Time saver. This needs to be pinned to the top of the thread because several persons experience inadvertent restart or shutdown of computer. – Kenny Dabiri Jun 08 '20 at 20:50
  • 1
    Throwing my hat in the ring for this answer. None of the others work, this one did. Stale lock file. Cheers! – Soulriser Nov 23 '20 at 17:17
  • 1
    Absolute gold, saved my rest of the day and tons of frustration. – Souvik Ghosh Jul 28 '21 at 12:10
  • 1
    I was struggling from last 3 hours to solve this issue but you SAVED my life and helped me. Thanks a lot. FYI It was working perfectly but when I updated my mac with MacOS Monterey today then mysql service was down then I have tried many solution, none of them worked except your's this perfect solution. Thanks again :) – Kamlesh Feb 25 '22 at 18:46
  • 1
    Thank you, sir! I was pulling out my hair until I found this :) – Peter Nov 06 '22 at 12:10
15
rm /Applications/MAMP/db/mysql56/*

Works fine, but then it shows "No database found" in phpmyadmin although there are databases, so my drupal gave me errors because of this.

All I need to do is simply remove two files ib_logfile0 and ib_logfile1 from /Applications/MAMP/db/mysql56/ and that did the trick for me.

JSEvgeny
  • 2,550
  • 1
  • 24
  • 38
13

I looked at the MAMP site. Go into MAMP/db/mysql56 and rename both the log files (I just changed the number at the end). Voila, restarted MAMP and all was well.

Log File names:

  1. ib_logfile0
  2. ib_logfile1
niton
  • 8,771
  • 21
  • 32
  • 52
Tracey
  • 131
  • 1
  • 2
  • Welcome to Stack Overflow. This answer would be even better if you provided the link your answer is based on. – Gary99 Jun 17 '17 at 00:10
  • 1
    As a MAMP / WordPress user, this was the only solution that fully worked for me—I just deleted those log files (and only those files), then when I started MAMP again, all was right with the world. – caleb531 Jun 23 '17 at 20:50
  • This also worked for me. All other options on this pages remove the tables from all DBs. – George Mastro Nov 10 '17 at 15:00
  • This is the easiest solution. I just appended a -O at the end of each log file and it fixed it. – stickdeodorant Dec 08 '18 at 18:58
12
  1. Stop MAMP server.
  2. Then go in following folder:

Applications/MAMP/db/mysql56/

In this folder, please remove all direct files except folders. This means that you have to remove only auto.cnf, ibdata, ib_logfile, not any folders.

  1. Restart MAMP server.

It should work.

Thank you.

Valter Lee
  • 137
  • 2
  • 5
10

Most of the answers here are offering to delete random files.

Most of the time, this is the worst thing to do especially if it is important for you to keep the integrity of your development environment.

As explained in the log file, if this problem is not related to a read access permission nor to a file you deleted in your mysql then the only solution is to:

Open your my.conf file from the File menu in MAMP (File > Edit Template > MySQL)

Find and edit this line to be: innodb_force_recovery = 1

Save with ctrl+S

MAMP will offer you to restart your servers

Go back building the next unicorn :)

Community
  • 1
  • 1
7

Just type below command in terminal:

rm /Applications/MAMP/db/mysql56/ib_logfile* 

and then restart the MAMP.

It works back perfectly.

Manish Shrivastava
  • 30,617
  • 13
  • 97
  • 101
6

I had to do a combination of things. First I had to change the permissions on my mysql directory. applications/MAMP/db/mysql56/mysql see Stackoverflow here

If that doesn't work add in a my.cnf file to applications/MAMP/conf folder with the following

[mysqld]
innodb_force_recovery = 1

see Adel 'Sean' Helal . answer

This is what ended up working for me.

Leo
  • 1,495
  • 23
  • 41
3

Im posting this as a potensial Answer!

What i did to solve this was the following:

  1. Restart the computer ( to make sure no mysqld processes are running, even if it crashed and tries to restart itself)
  2. Delete everything that has anything to do with mysql on the computer by running these commands:
    sudo rm /usr/local/mysql
    sudo rm -rf /usr/local/mysql*
    sudo rm -rf /Library/StartupItems/MySQLCOM
    sudo rm -rf /Library/PreferencePanes/MySQL*
    vim /etc/hostconfig and removed the line MYSQLCOM=-YES-
    rm -rf ~/Library/PreferencePanes/MySQL*
    sudo rm -rf /Library/Receipts/mysql*
    sudo rm -rf /Library/Receipts/MySQL*
    sudo rm -rf /var/db/receipts/com.mysql.*
  3. Delete MAMP by running the MAMP PRO uninstaller, then deleting the applications/MAMP folder
  4. Delete the Library/Application Support/appsolute folder (MAMP application support folder)
  5. Reinstall MAMP PRO

Hopefully this helps :)

Christer
  • 1,651
  • 1
  • 17
  • 34
3

I just had this problem. These are the steps that worked for me.

  1. Open Preferences in MAMP, make a note of your current Apache and MySQL Port numbers.

    enter image description here

  2. Click both Set to default Apache and MySQL ports and Reset MAMP buttons then OK.

  3. Quit MAMP

  4. Delete all files (not folders) from /Applications/MAMP/db/mysql directory.

  5. Reboot MAMP and click Start Servers.

    Note: if MySQL starts fine but Apache doesn't, go back to Preferences and set Apache Port back to what it was before. MAMP should refresh after you click OK and both Apache and MySQL should start.

  6. If http://localhost/MAMP/index.php fails to load, open Developer Tools (Chrome), right-click on refresh button and select Empty Cache and Hard Reload. The phpAdmin page should load. If not try going to Application panel in Developer tools, select Clear Storage from the menu and click Clear Site Data.

I hope those steps provide a quick fix for someone without needed to destroy your database tables.

mikeym
  • 5,705
  • 8
  • 42
  • 62
3

I’ve seen on different answers that we have to remove ib_logfile0 and ib_logfile1 in Applications/MAMP/db/mysql56/

If you use MAMP PRO 4, these files are in /Library/Application Support/appsolute/MAMP PRO/db/mysql56/

Removing theses fils works for me (the serveur doesn’t start after a system crash).

Sébastien Gicquel
  • 4,227
  • 7
  • 54
  • 84
2

Ok, so I tried EVERY suggestion i found here on SO and other forums I nothing worked for me. The only solution, that worked for me was to install MAMP 3 version, since I use MAMP for wordpress projects version 3 works just fine.

2

MAMP & MAMP PRO 4.0.6 was starting MySql server correctly but stopped doing so after my machine updated the OS to macOS Sierra (10.12.2). I tried a few options mentioned here including setting folder permissions and re-install etc. Nothing seemed fixed the issue for me so I shifted to XAMPP and it is serving OK so far.

Update: I've got MAMP working with this simple solution here.

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

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

Then restart MAMP.

Should Work!

2

I've tried all the solutions above with version 4.2 of MAMP and none of them worked to me in El Capitan OS, so the only thing that worked was uninstalled MAMP with Clean My Mac and then install the older 3.5.2 version, that one worked right away.

Thremulant
  • 566
  • 5
  • 15
2

Best way to find the real cause is to check the MAMP error log in MAMP > logs > mysql_error_log.err

I found the ERROR "Do you already have another mysql server running on port: 3306 ?" - which was actually the cause for my MAMP MYSQL not starting.

Port 3306 was already "busy", so I have changed it to 8306 and that solved my issue.

qjk
  • 81
  • 4
2

I was running MAMP 4.1 on windows and MYSQL 5.7 .Was having this problem many times and found out a fix for this: For me deleting the log files was not working then just delete

  • mysql-bin.index
  • YOUR_PC_NAME.pid

and boom it starts working again. If this also doesn't work for your, remember to delete each file one by one and keep checking if any works for you. Make sure to backup always.

MR_AMDEV
  • 1,712
  • 2
  • 21
  • 38
2

I just ran this in terminal: sudo killall -9 mysqld and then I force quit MAMP. Reopen Mamp and everything works perfectly.

Sometimes, just turning off and restarting your computer does the trick.

mateostabio
  • 958
  • 8
  • 11
  • This works for me, thanks (MacOS 10.15, MAMP Pro 5.7)! After running the terminal code MySQL didn't start at first, but after a second attempt in MAMP it worked. This is after trying a lot of the other suggestions here. – texelate Sep 13 '22 at 06:47
2

None of the above answers worked for me (I did MAMP upgrade to latest 5.7 on MacOS).

After a while of digging through the error log (/Applications/MAMP/logs/mysql_error_log.err) i found out that there's an error [ERROR] unknown variable 'thread_concurrency=8'] that causes termination.

Based on a post about upgrades i removed the directive from my.cnf and restarted MAMP. All worked well afterwards (was prompted to upgrade DBs, etc.)

David Jirman
  • 1,216
  • 12
  • 25
1

Here's what worked for me:

  • Check to see if you accidentally installed mysql via Brew or something. brew list mysql
  • Uninstall it brew uninstall mysql
  • Try to fire up MAMP. Might need to reinstall.
  • Eventually upgrade to Vagrant and stop fighting with MAMP.
corysimmons
  • 7,296
  • 4
  • 57
  • 65
1

What worked for me was:

I had a process called "mysqld" running even when MAMP had been quit. I force quit the process, restarted MAMP and it worked again.

Dallby
  • 596
  • 4
  • 19
1

In case of MAMP PRO you need to remove ib_logfiles here:

rm -rf /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile*
1

For me the line innodb_additional_mem_pool_size in my.cnf was causing it

Chris
  • 439
  • 4
  • 20
1

If you are using MAMP PRO 5.7+ (18029)

1.Just stop MAMPRO. 2.Goto to directory /Applications/MAMP/db/mysql## (Where ## is the Number of your Mysql version) 3.List the files with command: ls -l * 4. Type command: rm ib_logfile* #Just must delete theses 2 files. 5.Restart MAMPRO and its must works fine!

Caution: If you remove the files ibdata1 will destroy all you "databases"

Didierh
  • 374
  • 3
  • 8
  • Even this is not working for me, i recently upgraded to 5.7 and i tried many above steps. Nothing helped me.:( – Ajithkumar S Sep 21 '20 at 06:06
  • Double check whats process are active or hang-up while start Mysql Service. Try to kill all process related to Mysql, then restart MampPro. – Didierh Sep 22 '20 at 08:38
1

This is what worked for me (Windows 10) :

  1. Click on Start Servers in MAMP
  2. Manually click on mysql.exe in MAMP installation folder (C:\MAMP\bin\mysql\bin\mysql.exe)

Tip : You can pin mysql.exe to Start Menu so you don't always have to search for this folder

Hadi Yahia
  • 48
  • 5
0

I have mac system and my mamp does not start properly. Just restart my system and then start mamp again then it's working properly

cigien
  • 57,834
  • 11
  • 73
  • 112
Rinkal Jasani
  • 472
  • 5
  • 7
-6

You need to leave the mysql database AS IS.

  • Uninstall and reinstall MAMP Pro.
  • For every WP instance that you want to have on your server (localhost), you need to create a NEW database that is not mysql.
  • Go into SequelPro and add database.
  • Use Duplicator to transfer your WP.

Do not use mysql for anything, it appears to be required by MAMP.

Stefan
  • 1