Fix MAMP, MySQL Workbench “Failed to Connect to MySQL”

Installing MAMP was easy. I did, however, spend at least 45 minutes trying to get MySQL Workbench to connect to my local MySQL database server. The solution was simple, but getting there led me around the Internet and back with little help. Hopefully this signpost will help others having connection issues with MySQL Workbench to MAMP MySQL servers as well.

Once MAMP is installed and the MySQL server has started, you’ll be taken to a start screen that looks something like this:
MAMP Start Screen Port Number

The information presented there is misleading. The start page instructs you to use port 3306. So I did:
Settings based on MAMP Start Screen

When testing the connection, however, I got the dreaded “Failed to Connect to MySQL at localhost”:
Error on Test Connection

It turns out that MAMP has a preferences panel wherein you can configure the ports for your Apache and MySQL servers. And of course, MySQL was not set to use port 3306, as the start page led me to believe. Rather, it was set to use port 8889:
MAMP Preferences Port Number

Adjusting the settings to use the port listed in the MAMP preferences pane led to a successful connection!
Settings based on MAMP Preferences

Good to go!
Good to go!

comments powered by Disqus