0

I'm trying to connect to a MySQL db remotely for about 10 hours with no luck.

The server is running Debian.

The my.cnf is configured correctly with bind-ip 0.0.0.0 and no skip-networking.

lsof -i :3306 shows an established connection from the connecting IP to the server, but then dies off.

When using tcpdump port 3306 and '(tcp-syn|tcp-ack)!=0' on server I get this when trying to connect to it:

10:55:44.195273 IP server2.xxx.xxx.mysql > xxx.xxx.12.89.53920: Flags [R], seq 1740903883, win 0, length 0

The user connecting is granted all access from %.

I don't know what more to do. The server is running ISPConfig with bastille firewall but even with it off nothing works. I am able to connect to the db locally and LAN addresses.

This is what I get when I'm trying to connect to the db server:

"ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 2 "No such file or directory"

my.cnf

skip_name_resolve is on

bind address commented

Any clues?

  • 1
    From a remote host, are you able to nc -z -w 2 dbhost.example.com 3306 successfully? – DopeGhoti Oct 2 '17 at 18:41
  • The command executes without any return with the correct address. – Andreas Winkler Oct 2 '17 at 19:03
  • With what exit code? – DopeGhoti Oct 2 '17 at 19:04
  • No exit code at all – Andreas Winkler Oct 2 '17 at 19:24
  • 2
    Not possible. All programs return an exit code upon exit. Re-run the command, and follow it up with echo $?. – DopeGhoti Oct 2 '17 at 21:15
1

TCP networking is clearly working: you get a connection, and alternative connection tools such as nc also demonstrate this.

It is either MySQL blocking the incoming connection itself (likely) or your version has been compiled with TCP Wrappers and that is set to require Reverse DNS and maybe even forward/reverse matching.

The MySQL documentation B.5.2.5 Host 'host_name' is blocked explains that too many incomplete connections will cause the originating IP address to be blocked until mysqladm flush-hosts is run. Or you can login and execute FLUSH HOSTS.

To check the TCP Wrappers configuration you need to look at /etc.hosts.allow and /etc/hosts.deny.

  • I ran mysqladmin flush-hosts with exit value 0 on host and then tried to connect. No change. Content of hosts.allow ALL:ALL Content of hosts.deny Empty – Andreas Winkler Oct 3 '17 at 8:48
  • How do I check if compiled with TCP Wrappers? – Andreas Winkler Oct 3 '17 at 8:50
  • lsof -i :3306 shows *:mysql LISTEN on server. – Andreas Winkler Oct 3 '17 at 8:53
  • When using tcpdump port 3306 and '(tcp-syn|tcp-ack)!=0' on server I get this when trying to connect to it: 10:55:44.195273 IP server2.xxx.xxx.mysql > xxx.xxx.12.89.53920: Flags [R], seq 1740903883, win 0, length 0 – Andreas Winkler Oct 3 '17 at 8:57
  • I get this when trying to connect to db server: "ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 2 "No such file or directory" – Andreas Winkler Oct 3 '17 at 10:28

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.