Enable Remote Connections to MySQL

By default MySQL is configured in such a way that it won't accept remote connections. I'm guessing the is by design and a security feature. This makes sense because a lot of programs use a local MySQL database which should be secured from remote connections. Fortunately if you need to open up your MySQL database server it's an easy thing to do!

MySQL listens to incoming connections on port 3306 and by default, only listens on the localhost interface ( To accept remote incoming connections we simply need to bind the service to the IP address the server will be accepting incoming connections on.

First we need to edit the MySQL configuration file which can be found at /etc/mysql/my.cnf

sudo nano /etc/mysql/my.cnf

Next we're looking for a configuration line called bind-address. By default this is set to Change it to the IP address your MySQL server instance will be accepting connections on. When done, save the file and restart the MySQL service.

sudo service mysql restart

Now your MySQL server should be accepting remote connections. You can easily test this by trying to telnet to MySQL port from a remote machine using the following command:

telnet <ipaddress> 3306

You should receive a jumble of characters in response which indicates a successful connection. If you receive a connection timeout then you have another issue. Check your settings and check there are no other services running which block connectivity (such as firewalls).


Popular posts from this blog

Monitoring Raspberry Pi Performance Using Cacti

Using NAGIOS to Check the Physical Memory Available on a Windows Host

Error 2738 Occurs When Installing An MSI Package