Mysql 错误解决:ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet'

来源:互联网 发布:菲凡软件 编辑:程序博客网 时间:2024/05/29 13:16

mysql 在执行一条 insert 时出现如下错误:

ERROR 2013 (HY000): Lost connection to MySQL server at 'reading authorization packet', system error: 0

事后再次执行相同的SQL,成功


经分析,相同的方向正在 rsync 同步一个 2G 文件,导致网络IO、CPU都非常高,可能导致 mysql 服务器超时


检查 mysql 超时时间设置为 10 秒:

mysql> show variables like 'connect_timeout';

+-----------------+-------+

| Variable_name   | Value |

+-----------------+-------+

| connect_timeout | 60    |

+-----------------+-------+

1 row in set (0.00 sec)

 

还好 rsync 时间不长,所以暂时调大超时时间解决:

mysql> set global connect_timeout = 60;


同时更新 /etc/my.cnf,在 [mysqld] 项下添加:

connect_timeout = 60











0 0