Computers, Linux, Open-source, Software, Web, Windows

Ubuntu: connect to MySQL from remote host

Just a quick gotcha that I always stumble upon in Ubuntu. By default, the MySQL database is set only to listen to requests on the localhost (for security reasons). If you want to connect to the database remotely, say using MySQL Admin GUI Tools, you will need to make a quick change.

First run this to edit the MySQL config file with root permissions:

sudo vim /etc/mysql/my.cnf

Next, look for the property “bind-address” (press “/” in VIM to start a search). In Ubuntu server 7.04 it is on line 47 but this is total subject to change. Instead of it reading, change it to the static IP of the server. In most *nix distributions, this can be found by running “ifconfig”. My server configuration line now looks like this:

bind-address =

All that remains is to give the MySQL database a quick restart to apply the change:

sudo /etc/init.d/mysql restart