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.

Mamp

Steps to Fix

  1. Quit MAMP. You may have to force quit when this happens as it does not shut down correctly.
  2. Open Terminal and from the command prompt run:
    ps -ef | grep mysql

    This will show you any mysql processes that are still running. Note there are two processes running in this example (not including the grep process). The process id’s are 38585 and 39048. Note these id’s will be different on your system!

    ps -ef | grep mysql

  3. Next, from within terminal, kill the two processes.
    sudo kill -9 38585 39048

    To verify they no longer exist, we’ll grep for mysql again

    ps -ef | grep mysql


    ps -ef | grep mysql

  4. Now launch MAMP again and it should start normally, including MySQL Server.MAMP

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:

<Limit GET HEAD POST>
order allow,deny
deny from 202.70.112.0/20
allow from all
</LIMIT>

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]