MacLochlainns Weblog

Michael McLaughlin's Technical Blog

Site Admin

MySQL bind-address

without comments

While I try to keep things simple, sometimes eliminating options and explanations comes back to haunt me. After posting how to open a Fedora firewall port for a LAMP stack, somebody got trapped by my instructions for installing MySQL on Fedora. They got stuck because they had the following setting in their /etc/my.cnf file:

bind-address=localhost.localdomain

I’d suggested using that bind-address value for a DHCP VMware Fedora installation in Step #7. I was trying to create an example for an isolated testing instance, which is why I set the bind-address to a localhost.localdomain value. They raised the following error when they tried to connect their base operating system’s version of MySQL Workstation to the Fedora VM:

Failed to Connect to MySQL at 192.168.2.168:3306 with user student

or, this dialog image:

MySQLBindAddr01

Before you do the next step, please ensure you’re using the right IP address. You can find that by running this command as an authorized sudoer:

ifconfig | grep inet.*netmask.*broadcast

In this case, the command returns:

        inet 192.168.2.168  netmask 255.255.255.0  broadcast 192.168.2.255

I’ve since added instructions to the older post to set the bind-address value in the my.cnf file as follows when they want to support external connections (naturally that means authorizing port 3306):

bind-address=0.0.0.0

After you reset the /etc/my.cnf file, you must stop and start, or restart the mysqld service. You can do that as the root user like this:

systemctl restart mysqld

Then, you can test a student user connection from MySQL Workbench like this:

MySQLBindAddr02

If the student user is authorized and the password is correct, you’ll see that the connection now works:

MySQLBindAddr03

As always, I hope this helps those working through similar issues.

Written by maclochlainn

March 29th, 2015 at 10:30 pm