首页 文章

修复错误mysql服务器已经消失[关闭]

提问于
浏览
4

我的VPS经常无法"MySQL server has gone away (error 2006)"并失去连接 . 我在my.cnf中增加了变量的值,但条件没有改善 . 这是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

1 回答

  • 5

    wait_timeoutnet_read_timeout 增加到大于180秒(3分钟)的内容,如3600秒,如果有些查询需要更长时间,或者您获得的结果集非常大 . 如果结果集非常大,您可能还希望将 max_allowed_packet 增加到大于256M的值 .

相关问题