mysql error.log 显示
[Warning] Aborted connection 320935 to db: '...' user: '...' host: '...' (Got an error reading communication packets)
Run Code Online (Sandbox Code Playgroud)
虽然客户端得到:
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'
Run Code Online (Sandbox Code Playgroud)
我阅读了有关此内容的mysql 手册以及许多其他线程。所以我在 my.cnf 中更改了一些值
max_allowed_packet = 512M
connect_timeout = 60
net_read_timeout = 120
innodb_buffer_pool_size = 5G
Run Code Online (Sandbox Code Playgroud)
查看连接断开的查询日志:
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
Run Code Online (Sandbox Code Playgroud)
检查表状态。bind-address 是服务器 IP,但我需要能够从外部连接。
Aborted_connects is 196
Run Code Online (Sandbox Code Playgroud)
基于有限的数据,我想知道客户端和 MySQL 服务器之间是否有防火墙(可能直接位于主机上),它允许 3306 到 MySQL 服务器,但阻止对初始 SYN 请求的响应数据包。
您可能需要在两侧执行数据包转储,以了解 TCP 端发生的情况和/或检查两侧之间存在的任何防火墙。