Unix & Linux Stack Exchange is a question and answer site for users of Linux, FreeBSD and other Un*x-like operating systems. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

I have an OpenVPN server installed on a server. What I'm trying to do connect from the OpenVPN server using the mysql client to the MySQL server than is connected to the OpenVPN server using a client. I can ping back and forth between the servers, no issues. However, if I use the MySQL client on the OpenVPN server to try to connect to the MySQL server I get a

ERROR 2003 (HY000): Can't connect to MySQL server on '' (111)

with being the connected to the OpenVPN server at

I thought it might be IPTables but adding explicit INPUT and OUTPUT one the client and the server didn't change anything. Telnet 3306 didn't work either. I have verified that MySQL is running on 3306:

me@db:~# lsof -i4 -P | grep -i mysql
mysqld  6192 mysql   10u  IPv4  40596      0t0  TCP localhost:3306 (LISTEN)

So what am I doing wrong? Google has been less than helpful, as far as what I could find it should just work.

share|improve this question
up vote 2 down vote accepted

Your MySQL server is listening only to localhost ( so you can't connect to it from other servers. This is a default "safe" setting to prevent other machines from being able to connect to MySQL unless you explicitly allow it.

Edit your my.cnf file (probably in /etc/my.cnf) and change the bind-address from to one of:

  • The IP address of your MySQL server
  • to listen on all IPv4 addresses configured on the server
  • :: to listen on all IPv4 and IPv6 addresses.


share|improve this answer
That's it. The address binding was for, commented that out, restarted MySQL and it works. Thanks. – Ross R Apr 4 '13 at 12:15

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

Not the answer you're looking for? Browse other questions tagged or ask your own question.