修复错误mysql服务器已消失 [英] Fix error mysql server has gone away

查看:136
本文介绍了修复错误mysql服务器已消失的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我的VPS通常无法"MySQL服务器已消失(错误2006)" ,并且失去连接.我增加了my.cnf中变量的值,但条件没有改善.这是my.cnf:

My VPS very often fails to "MySQL server has gone away (error 2006)" and loses connection. I have increased the value of the variable in my.cnf but the condition did not improve. Here is my.cnf:

[mysqld]
port            = 3306
socket          = /var/lib/mysql/mysql.sock
default-storage-engine=myisam
datadir=/var/lib/mysql
old_passwords=1
skip-bdb
skip-innodb
max_allowed_packet = 256M
table_cache= 512M
wait_timeout = 180
max_connections = 2000
net_read_timeout= 180
query_cache_size = 512M
query_cache_limit = 512M
max_user_connections=300

[client] 
socket=/var/lib/mysql/mysql.sock
max_allowed_packet = 128M
[mysqld_safe]
log-error=/var/log/mysqld.log
pid-file=/var/run/mysqld/mysqld.pid

推荐答案

如果某些查询需要更长的时间或获得结果,则将wait_timeoutnet_read_timeout增大到大于3600sec的180sec(3分钟),例如3600sec.真的很大如果结果集很大,您可能还想将max_allowed_packet增大到大于256M.

Increase your wait_timeout and net_read_timeout to something bigger than 180sec (3mins) like 3600sec if there are some queries that takes longer or if you are getting results sets that are really big. You may also want to increase max_allowed_packet to something bigger than 256M if your result sets are really big.

这篇关于修复错误mysql服务器已消失的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆