Enable Remote Access to MySQL

I haven’t set MySQL up in years; it’s always on the server, and I guess we never try to access it from outside.

So… I had completely forgotten about allowing access. Fortunately, it only took a few quick Googles before I had the answer and, even though it’s in a million other places, I’m going to add it here since I want to be able to use this blog as my reference.

Edit, on Ubuntu, with:

	$ sudo vim /etc/mysql/my.cnf

And make it look like this:

[mysqld]
user = mysql
pid-file = /var/run/mysqld/mysqld.pid
socket = /var/run/mysqld/mysqld.sock
port = 3306
basedir = /usr
datadir = /var/lib/mysql
tmpdir = /tmp
language = /usr/share/mysql/English
bind-address = 127.0.0.1
bind-address = you.re.ip.add
# skip-networking

In 5.1.x it seems that `skip-networking` has been dropped as the default and `bind-address` is 127.0.0.1 by default. I just left that in place and added my IP address. I’m not sure if that’s right, but it works.

I found the full reference here. I really like that ‘nixCraft’ site; I seem to end up there a lot.

1 Comment

[...] per a previous post, I had enabled remote access to MySQL by modifying the `my.cnf` file and, at that time, I had [...]

Leave a comment

You must be logged in to post a comment.