MAMP MySQL Server Won’t Start

This was a common problem with past versions of MAMP and it continues to happen for some users in version 4.x. Fortunately, the fix is easy. The problem is that when exiting MAMP the MySQL processes continue to run and are not stopped. This post has two solutions. The first solution of killing running processes has worked for me pretty much all the time. The second solution is from one of the comments below.

  1. Quit MAMP. You may have to force quit when this happens as it does not shut down correctly.
  2. To show any MySQL processes currently running, open Terminal and from the command prompt run the command below.
    pgrep mysql
  3. Next, kill the MySQL processes by running the command below.
    pgrep mysql | xargs kill -9
  4. To verify they no longer exist, pgrep for mysql again and you should not have any processes returned.
    pgrep mysql
  5. Now Launch MAMP again and MySQL Server should start normally.

Alternative Solution

If the above solution does not work, this method should.

  1. Stop Mamp and kill the mysql processes as above.
  2. Rename the ib_logfileN (N is the log numbers) files to something else. Don’t delete these as you may need to return to them. The path to these files may be different on your system. On my system, I would do the following:
    mv /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile0 /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile_0
    mv /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile1 /Library/Application\ Support/appsolute/MAMP\ PRO/db/mysql56/ib_logfile_1
  3. Restart MAMP and MySQL should start correctly.
    (Thanks to Daniel Erkalo for this alternative fix!)

Block IP Addresses by Country

One of the worst things about being a webmaster is the constant battle we wage against spammers and scrapers. A majority of these creeps have IP addresses which originate from outside the United States in countries like China, Russia, Latvia and Nigeria.

After years of being a webmaster, I have found that a majority of these countries send only bots and other nefarious users to my sites. So I use htaccess IP banning to handle these net-scumbags most of the time.

IP banning in a htaccess file looks like this:

order allow,deny
deny from
allow from all

There are many services online that will give you IP CIDR block listings by country such as IPDeny, Block a Country and Country IP Blocks. The last two will actually generate the htaccess deny statements for you, which is a huge time saver.

If you ever find the need to block country IP’s, be sure to check out the sites above.

[contentblock id=3 img=adsense.png]