Posted by: Anthony Drewery | October 24, 2006

Enabling remote connections to a MySQL server

By default MySQL only permits connections from the server on which it resides. Although this makes for good security there may be times when you need to access the database from elsewhere. This might be using ODBC from your office or maybe a script running on a separate web server.

Using a SSH client like PuTTY connect to your MySQL server. You then need to edit /etc/my.cnf (# vi /etc/my.cnf).

Under the [mysqld] section comment or remove the skip-networking line and add the bind-address=IP_of_MYSQLserver line e.g.

[mysqld]
datadir=/var/lib/mysql
socket=/var/run/mysqld/mysqld.socket
bind-address=192.168.99.99
# skip-networking

Save the file then restart the MySQL service (# /etc/init.d/mysqld restart) 

Now using the MySQL admin tool of your choice create your user accounts but specify the host that they will be connecting from. For example if you are creating a user that connects from the IP address 80.65.35.43 the username will be in this format: username@80.65.35.43


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 )

Twitter picture

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

Facebook photo

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

Google+ photo

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

Connecting to %s

Categories

%d bloggers like this: