MAMP "Apache couldn't be started because port is in use." AND "Can’t connect to local MySQL server through /tmp/mysql.sock MAMP "Apache couldn't be started because port is in use." AND "Can’t connect to local MySQL server through /tmp/mysql.sock php php

MAMP "Apache couldn't be started because port is in use." AND "Can’t connect to local MySQL server through /tmp/mysql.sock


I don't know if it will help someone... but this worked for me :

sudo apachectl stop :-)

from https://stackoverflow.com/a/24287496/1420009


I ran into the very same problem after upgrading to yosemite and the MAMP Version 3.0.7.3. Tried a lot of suggestions and fix out there, but none of them worked for me.

When it hit me! When hitting the "Set Web &MySQL ports to 80 & 3306" button in MAMP, MAMP sets port 80 for Apache AND Nginx. Resulting an an error since both are set to use the same port. I simply set Nginx to another random port, hit the "OK" button and no error appeared.

I restarted Apache and MySQL. And voila!

All my localhost sites are working just as they were before the update.

Luckily, i just had read an interesting article explaining how to set up Nginx in front of Apache to serve static and dynamic independently to optimize performance. Which sparked the idea.

I hope it helps!


Go to the MAMP configuration and change the port address 8888 to any other address

MAMP->Preferences->Ports->Apache Port

I think it will work fine