Error: Broken Pipe/MySQL Server has gone away

Error: Broken Pipe/MySQL Server has gone away

MySQL 抛出 Broken Pipe 和 MySQL Server has gone away 错误。我的数据库 table 包含我每隔 1 小时定期插入大 HTML 的文本字段。

我应该考虑设置哪个 MySQL 变量。

这是当前配置:

[mysqld]
datadir=/home/monk/mysql
socket=/home/monk/mysql/mysql.sock
user=mysql
default_time_zone='+06:00'
innodb_buffer_pool_size=35G
innodb_buffer_pool_instances=15
query_cache_type=ON
query_cache_size=64M
join_buffer_size=524288
tmp_table_size=32M
max_heap_table_size=32M  


# Disabling symbolic-links is recommended to prevent assorted security risks
symbolic-links=0
max_allowed_packet=1G
# Recommended in standard MySQL setup
sql_mode=NO_ENGINE_SUBSTITUTION,STRICT_TRANS_TABLES

wait_timeout = 2000
interactive_timeout = 2000



#bind-address=127.0.0.1
##skip-networking~   

我认为,max_allowed_packet 应该是 256MB 就足够了,你的网络连接速度可能很慢。也试试下面的变量。

将 net_write_timeout 设置为双倍和 在反弹中增加 net_buffer_length。

另外,你的盒子里有多少 ram,你是不是都带走了 innodb_buffer_pool,将它设置为盒子 ram 的 70% 到 80%。

另一个建议是关闭查询缓存,因为它是网络内容。