Server Administration & Management

How to enable remote access to a MySQL Server

MySQL is often configured to be accessible from the local host only. The MySQL configuration file is at /etc/mysql/my.cnf on Debian and similar distros and /etc/my.cnf on CentOS, Red Hat Enterprise Linux and Fedora. It contains a bind-address setting which is often set as follows by default:

bind-address =

This binds the MySQL deamon to which is the local machine and means it will not be able to be accessed from other machines, whether or not the firewall and/or privilege grant options allow it.

To allow it to be accessible from any host, comment the line out as shown in the following example and then restart MySQL:

#bind-address =

Note that you could set the IP address to that of the server but it will mean all connections to the MySQL server must be via that IP address as it is not currently possible to bind MySQL to more than one IP address. It’s simply easier to comment the line out.

# /etc/init.d/mysql restart

You’ll still need to enable access to the MySQL server through the firewall from the remote server(s) and add/modify the appropriate permissions to the privileges tables.

February 16, 2011 - Posted by | MySQL | ,

1 Comment »

  1. I’ve recently been searching for specifically this information. Even though I was expecting to find this content I am truly impressed that your blog was so easy to find and how it perfectly when compared to my own experience.

    Comment by amazing water filter | June 16, 2011 | Reply

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out /  Change )

Google photo

You are commenting using your Google account. Log Out /  Change )

Twitter picture

You are commenting using your Twitter account. Log Out /  Change )

Facebook photo

You are commenting using your Facebook account. Log Out /  Change )

Connecting to %s

%d bloggers like this: