Mysql – problems connecting to port 3306 thesql workbench with XAMPP

MySQLportxampp

I'm trying to learn the apache / mysql / php stack bundled with XAMPP. I can't connect to the MySQL server using the MySQL workbench:

Your connection attempt failed for user 'root' from your host to server at localhost:3306: Can't connect to MySQL server on '127.0.0.1' (61)

Thinking it's a port problem, I check the port directly in Terminal with the command telnet 3306:

telnet: connect to address 127.0.0.1: Connection refused

Obviously the problem isn't with the Workbench, but something to do with the port connection itself.

I'm using:

  • OS 10.8 Mountain Lion
  • XAMPP 1.7.3
  • MySQL workbench 5.2.47

Best Answer

Sorry all, I'm posting my own question and answer. I had this problem and it nearly destroyed me because I could not find the correct answer anywhere on the interwebz. I finally overcame it, and wanted to post my findings in case it helps another befuddled traveler.

It turns out when you install XAMPP and choose to run the security routines, it automatically turns on a setting in the MySQL preferences to block connections on port 3306 from localhost. To fix this, open my.cnf in the xampp folder xamppfiles/etc. Look for the setting "skip-networking" which tells mySQL to block the port 3306. Comment this out by adding a pound sign so it is "#skip-networking". Now, the telnet command should work, and you should be able to use the Workbench.

Hope this is helpful for somebody!If it fixes your problem, give me a shout at @mrcheeks3185.