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.


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.


  • 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 clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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