0

From my mac, I installed mysql56+server through macports 4 months ago. Today after a laptop restart, I wasn't able to connect to MySQL anymore through SQL Pro. I can only connect through the Terminal. I have posted some relevant information below.

Command that successfully works for connecting to MySQL (after entering password):

/opt/local/etc/mysql56 mysql -u root -p

Command that fails to connect to MySQL:

/opt/local/etc/mysql56 mysql -u root -p -h '127.0.0.1'
Enter password: 
ERROR 2003 (HY000): Can't connect to MySQL server on '127.0.0.1' (61)

/opt/local/etc/mysql56 telnet 127.0.0.1 3306
Trying 127.0.0.1...
telnet: connect to address 127.0.0.1: Connection refused
telnet: Unable to connect to remote host

/etc/hosts contains:

127.0.0.1       localhost
255.255.255.255 broadcasthost
::1             localhost
fe80::1%lo0     localhost

The my.cnf file that I am using has everything commented out. I do not want to use a socketed connection, just standard 127.0.0.1 connection that I was using in SQL Pro.

matt
  • 223
  • 4
  • 13
  • localhost != 127.0.0.1 and you should use localhost whenever possible. Enabling network access to your database is something that should be avoided unless absolutely necessary. – miken32 Feb 03 '16 at 00:17

2 Answers2

1

In your my.cnf file, find bind-address and change it to (or comment out):

bind-address = 0.0.0.0
#bind-address = 0.0.0.0

After that restart mysql and try to connect:

mysql.server restart
mysql -u root -p -h '127.0.0.1'
admix
  • 1,752
  • 3
  • 22
  • 27
  • I tried adding the following to /opt/local/etc/mysql56/my.cnf and restarting, but am still getting the same error. [mysql] bind-address = 0.0.0.0 – matt Feb 02 '16 at 06:31
0

This is a duplicate of both

See also the output of port notes mysql56-server, which explains this and was printed during installation.

Community
  • 1
  • 1
neverpanic
  • 2,918
  • 18
  • 27