MySQL Net Setup Problem

In the process of setting up MySQL 5.0.32 on Debian Etch recently I ran into a frustrating problem. The server was installed correctly. The users were set up correctly, with the right established roles. I could connect to the server fine from the machine it was installed on, but not from any other machine on the LAN. I had run through the configuration in the MySQL Administrator three or four times to make sure I wasn’t missing anything, principally to keep squinting at the “Disable networking” checkbox to make sure it was clear. It was clear. It WAS CLEAR, dammit. But no matter: I could connect from the local system, but not from the Windows box sitting next to it. Trying from the MySQL Administrator program yielded the following…

mysql_neterr.png

From the command line it looked like this…

ERROR 2003 (HY000): Can’t connect to MySQL server on ‘192.168.0.105’ (111)

I Googled every combination of terms I could think of. At one point I ran across a discussion where someone seemed to be having the same problem, and about halfway down the page someone else suggested editing something in a conf file. Figuring I didn’t want to mess with conf files just yet (there MUST be a checkbox I missed SOMEWHERE) I kept butting my head against the problem. Finally, in a flash of what you wouldn’t call inspiration, given that I had been making no progress for thirty minutes, I tried the actual IP address rather than ‘localhost’ from the local host. No go. Aha… so it certainly acts like networking is disabled.

I went back and reread that discussion, and that’s when I learned about the variable bind-address in /etc/mysql/my.cnf. Here’s what it looks like after a default install…

# Instead of skip-networking the default is now to listen only on
# localhost which is more compatible and is not less secure.
bind-address = 127.0.0.1

What it means is that in the default install mysqld will only bind to localhost (127.0.0.1). That interface has no communication with the outside world. The solution is just to comment it out, and suddenly everything works. You would think that the default install would also show “Disable networking” as “true” in the administrator when networking is… uhm… disabled, but I’m probably just not getting it yet.

Leave a Reply

Your email address will not be published. Required fields are marked *