2006 年:MySQL 服务器消失了 [英] 2006: MySQL server has gone away

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

问题描述

我经常收到与 MySQL 服务器的连接丢失"和2006:MySQL 服务器已消失"错误,以至于服务器无法使用.SO中有与此问题相关的问题,但没有一个适用于我的情况;例如,没有网络连接(服务器通过套接字连接到同一台机器上的客户端进程)并且没有长查询(机器正在运行许多 CMS - mediawiki、drupal 和 joomla - 和PHPMyAdmin,但生成的查询没有什么特别之处,AFAIK).

I am getting 'Lost connection to MySQL server' and '2006: MySQL server has gone away' errors so frequently that the server is unusable. There are questions related to this issue in SO, but none that apply to my situation; for instance, there is no network connection (the server is connected by a socket to the client process which is on the same machine) and there are no long queries (the machine is running a number of CMS - mediawiki, drupal and joomla - and PHPMyAdmin, but there is nothing exceptional about the queries generated, AFAIK).

我已将所有超时增加到一定足够的程度:

I have increased all the timeouts to the point where they must surely be sufficient:

+-----------------------------+----------+
| Variable_name               | Value    |
+-----------------------------+----------+
| connect_timeout             | 60       |
| delayed_insert_timeout      | 300      |
| innodb_flush_log_at_timeout | 1        |
| innodb_lock_wait_timeout    | 50       |
| innodb_rollback_on_timeout  | OFF      |
| interactive_timeout         | 28800    |
| lock_wait_timeout           | 31536000 |
| net_read_timeout            | 6000     |
| net_write_timeout           | 6000     |
| rpl_stop_slave_timeout      | 31536000 |
| slave_net_timeout           | 3600     |
| wait_timeout                | 28800    |
| max_allowed_packet          | 16777216 |
+-----------------------------+----------+

我还将 php.ini 中的 connect_timeout 设置更改为无限制:

I have also changed the connect_timeout setting in php.ini to unlimited:

; Maximum time (in seconds) for connect timeout. -1 means no limit
; http://php.net/mysql.connect-timeout
mysql.connect_timeout = -1

重新启动服务器可以解决几个小时的问题.之后,每次通过 CMS(即通过 PHP)和通过带有简单查询的小型 PHP 测试程序进行的访问都会失败.但是,我仍然可以通过 MySQL 客户端访问 MySQL 服务器和数据库.

Restarting the server clears the problem for some hours. After that, every access through the CMSs (i.e. through PHP) and through a small PHP test program with a trivial query fails. However, I can still access the MySQL server and the databases through the MySQL client.

MySQL 错误日志中没有错误消息.

There are no error messages in the MySQL error log.

服务器在最近的 Mac Mini 上运行,使用 Mac OS X 10.9.5、MySQL v5.6.22 和使用 Mac Port 安装的 PHP v5.6.3.

The server is running on a recent Mac Mini, using Mac OS X 10.9.5, MySQL v5.6.22 and PHP v5.6.3 installed using Mac Port.

你能帮助我解决这个问题吗?

Can you help with ideas where I should look to deal with this?

推荐答案

这个错误通常发生在服务器超时时,可能是由于连接关闭,所以可能是 http://dev.mysql.com/doc/refman/5.0/en/gone-away.html帮助你.

This error is usually occurs while server time out and may by be connection is closed , So may be http://dev.mysql.com/doc/refman/5.0/en/gone-away.html will help you.

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

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