Dev-Picayune

picayune: of little value or importance

MySQL Connection Issues

Yesterday, I was ready to pull my hair out trying to figure out why I couldn’t connect to the MySQL server running on the computer right next to me. I kept getting the (2003) Can't connect to MySQL server on 'server' (10061) error. I had checked the configuration settings in the MySQL-Admin program and looked at all the immediately obvious things (i.e. made sure that the mysqld was not launched with –skip-networking or something like that). I managed to establish a tunnel-based connection from one computer to the other using SSH (actually, PuTTY on the Windows client). So I knew it worked, that the physical connection between the two computers worked. But why could connect via SSH but not via the normal interface on port 3306? At first, I thought it had something to do with the port. Eventually, I stumbled onto a setting (on an Ubuntu machine) in the /etc/mysql/my.cnf file. This section is where the issue is:

 # 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 


If you comment out the bind-address line, it’ll open it up to receive connections from outside of the localhost (after restarting MySQL, of course). Apparently, this is the default setting for MySQL when installed via the Debian packages. I certainly understand the reason (the default password for root is blank) for locking it down out of the box, I just wish it had been easier to find out how to resolve it.

Technorati Tags: , ,

1 Comment so far

  1. Rick September 20th, 2006 5:18 pm

    Excellent answer. As a newbie I needed this info cheers. Would been handy to inlcude a mysql server restart command :-), time for another surf!

Leave a reply

For spam filtering purposes, please copy the number 6792 to the field below: