The mysql error.log shows

[Warning] Aborted connection 320935 to db: '...' user: '...' host: '...' (Got an error reading communication packets)

While the client side get's:

Lost connection to MySQL server at 'reading initial communication packet', system error: 111
Lost connection to MySQL server at 'reading authorization packet', system error: 0
and after a while: Host '...' is blocked because of many connection errors; unblock with 'mysqladmin flush-hosts'

I read mysql manual about this, and a lot of other threads. So I changed some values in my.cnf

max_allowed_packet      = 512M
connect_timeout = 60
net_read_timeout = 120
innodb_buffer_pool_size = 5G

Looked at query log of a broken connection:

22400 Connect user@host on dbname
22400 Query SELECT @@sql_mode
22400 Query     SET SESSION sql_mode=''
22400 Query     SET NAMES utf8
22400 Init DB   dbname
22400 Init DB   dbname

Checked table status. bind-address is the server IP but I need to be able to connect from outside.

Aborted_connects is 196
  • Can you check the connection quality between the two hosts ? basic 100 pings should do.. – melsayed Jul 6 '14 at 1:57

Based off of the limited data I wonder if you have a firewall between the client and the MySQL server (it may be on the hosts directly) which permits 3306 to the MySQL server but is blocking response packets to the initial SYN request back.

You may want to perform a packet dump on both sides to work out what is happening on the TCP side and/or check any firewalls that exists between both sides.

  • Thanks. What data could I provide to clear this up? I don't have a firewall on my end, not sure about the other side. Mostly the connection works, so I guess it's not a firewall. I tried packet dumping but there is a lot of traffic and the problem shows only a few times a day. I failed at defining a filter that only captures the packets I need. – PiTheNumber Jul 7 '14 at 10:55

I suspect this is not a mysql issue as such.

Verify that the transport layer is OK. Can you get a tcp connection using telnet [db_server] 3306 ?

Are your client and server in agreement about whether the connection should be SSL encrypted?

I can't think of many situations where I'd want to run a mysql connection over the public internet, which I suspect is what you mean by 'able to connect from outside'. If unencrypted, this is a huge security risk, and the overhead of setting up SSL for each connection is too high for most uses. You might want to look at using a persistent encrypted tunnel of some sort.

  • telnet connect and most connections work fine only from time to time this problem appears. Yes, it's a connection over the public internet. I would like to have encryption here but I don't control the other end. Anyway I first need to stabilize the connection. – PiTheNumber Jul 7 '14 at 10:51

Aborted connection is considered a connection error in MySQL which may not logged in MySQL error log. See dropped TCP connections not logged as errors but result in blocked host.

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.