Home >Database >Mysql Tutorial >MySQL日志中Communication Errors and Aborted Connec...

MySQL日志中Communication Errors and Aborted Connec...

WBOY
WBOYOriginal
2016-06-07 16:14:371093browse

130504 2:14:32 [Warning] Aborted connection 13145 to db: tjss_pmanager user: xxxx host: 192.168.0.96 (Got an error writing communication packets) 130504 2:15:13 [Warning] Aborted connection 13146 to db: tjss_pmanager user: xxxx host: 192.1

130504  2:14:32 [Warning] Aborted connection 13145 to db: 'tjss_pmanager' user: 'xxxx' host: '192.168.0.96' (Got an error writing communication packets)
130504  2:15:13 [Warning] Aborted connection 13146 to db: 'tjss_pmanager' user: 'xxxx' host: '192.168.0.93' (Got an error writing communication packets)

如果你的sleep进程数在同一时间内过多,再加上其他状态的连接,总数超过了max_connection的值,那mysql除了root用户外,就无法再继续处理任何请求无法与任何请求建立连接或者直接down了。所以,这个问题在大负载的情况下还是相当严重的。如果发现你的mysql有很多死连接存在,首先要先检查你的程序是否使用的是pconnect的方式,其次,检查在页面执行完毕前是否及时调用了mysql_close(),


还有一个办法,你可以在my.cnf里面加上wait_timeout和interactive_timeout,把他们的值设的小一些,默认情况下wait_timeout的值是8小时的时间,你可以改成1个小时,或半个小时。这样mysql会更快的杀死死连接。防止连接总数超过max_connection的值。或者把max_connection的值设置的更大,不过这样显然不妥,连接的数量越多,对你服务器的压力越大。实际上那些连接都是冗余的,把它们尽快杀死才是上策。

官方网站有详细的解释: http://dev.mysql.com/doc/refman/5.1/en/communication-errors.html

Statement:
The content of this article is voluntarily contributed by netizens, and the copyright belongs to the original author. This site does not assume corresponding legal responsibility. If you find any content suspected of plagiarism or infringement, please contact admin@php.cn