1.在my.ini文件中添加或者修改以下两个变量:
wait_timeout=2880000
interactive_timeout = 2880000

关于两个变量的具体说明可以google或者看官方手册。
如果不能修改my.cnf,则可以在连接数据库的时候设置CLIENT_INTERACTIVE,比如:
sql = "set interactive_timeout=24*3600";
mysql_real_query(...)

2.执行一个SQL,但SQL语句过大或者语句中含有BLOB或者longblob字段。
比如,图片数据的处理
解决方案

在my.cnf文件中添加或者修改以下变量:
max_allowed_packet = 10M  (也可以设置自己需要的大小)

max_allowed_packet 参数的作用是,用来控制其通信缓冲区的最大长度。

17.4.1.20 Replication and max_allowed_packet

max_allowed_packet sets an upper limit on the size of any single message between the MySQL server and clients, including replication slaves. If you are replicating large column values (such as might be found in TEXT orBLOB columns) and max_allowed_packet is too small on the master, the master fails with an error, and the slave shuts down the I/O thread. If max_allowed_packet is too small on the slave, this also causes the slave to stop the I/O thread.

Row-based replication currently sends all columns and column values for updated rows from the master to the slave, including values of columns that were not actually changed by the update. This means that, when you are replicating large column values using row-based replication, you must take care to set max_allowed_packetlarge enough to accommodate the largest row in any table to be replicated, even if you are replicating updates only, or you are inserting only relatively small values.

参考资料:

http://dev.mysql.com/doc/refman/5.5/en/replication-features-max-allowed-packet.html

http://stackoverflow.com/questions/7942154/mysql-error-2006-mysql-server-has-gone-away

mysql 2006的更多相关文章

  1. MySQL 2006 超时

    http://ronaldbradford.com/blog/sqlstatehy000-general-error-2006-mysql-server-has-gone-away-2013-01-0 ...

  2. mysql 2006错误 导入时

    导入数据库报此错误 1.找到my.ini (免安装版的是由于你自己创建的) (安装版的在 C:\ProgramData\MySQL\MySQL Server 8.0   你安装的盘位置) 2.修改参数 ...

  3. mysql 2006 go away 错误

    https://blog.csdn.net/yypsober/article/details/71330673 原文地址.

  4. 使用mysql的长连接

    有个资料看得我云里雾里的.现在用自己的言语来总结一下,写文字,能够加深自己的理解.也会在写的过程中帮助自己发现理解方面瑕疵,继续查资料求证. 短链接的缺点:创建一个连接,程序执行完毕后,就会自动断掉与 ...

  5. mysql高可用架构 -> MHA简介-01

    作者简介 松信嘉範:MySQL/Linux专家2001年索尼公司入职2001年开始使用oracle2004年开始使用MySQL2006年9月-2010年8月MySQL从事顾问2010年-2012年 D ...

  6. mysql的MHA高可用

    一.MHA简介 作者简介 松信嘉範: MySQL/Linux专家 2001年索尼公司入职 2001年开始使用oracle 2004年开始使用MySQL 2006年9月-2010年8月MySQL从事顾问 ...

  7. Linux实战教学笔记39:Mha-Atlas-MySQL高可用方案实践(一)

    一,mysql-mha环境准备 1.1 实验环境: 主机名 IP地址(NAT) 描述 mysql-db01 eth0:192.168.0.51 系统:CentOS6.5(6.x都可以) 安装:mysq ...

  8. Mha-Atlas-MySQL高可用方案实践

    一,mysql-mha环境准备 1.1 实验环境: 1.1 实验环境: 主机名 IP地址(NAT) 描述 mysql-master eth0:10.1.1.154 系统:CentOS6.5(6.x都可 ...

  9. 第十一章· MHA高可用及读写分离

    一.MHA简介 1.1.作者简介 松信嘉範: MySQL/Linux专家 2001年索尼公司入职 2001年开始使用oracle 2004年开始使用MySQL 2006年9月-2010年8月MySQL ...

随机推荐

  1. android 60 发送短信

    import android.os.Bundle; import android.app.Activity; import android.telephony.SmsManager; import a ...

  2. HDU2084JAVA

    数塔 Time Limit: 1000/1000 MS (Java/Others)    Memory Limit: 32768/32768 K (Java/Others)Total Submissi ...

  3. Oracle11g新特性导致空表不能导出问题

        ORACLE 11G在用EXP导出时,发现空表(没有数据或者没有用过的表)不能导出了.     查了一下资料,说是Oracle 11G中有个新特性,当表无数据时,不分配segment,以节省空 ...

  4. GUI编程笔记(java)05:GUI事件监听机制原理和举例说明

    1.事件监听机制:       A:事件源          事件发生的地方       B:事件             就是要发生的事情       C:事件处理       就是针对发生的事情做 ...

  5. 基于bootstrap的datetimepicker插件

    1.当时使用的资源地址:http://www.bootcss.com/p/bootstrap-datetimepicker/ 2.如何让时间只显示到日期,不显示具体时刻 控制显示精度的是datetim ...

  6. 借鉴网上的winform模仿QQ窗口停靠功能稍作改动

    2015-07-11 15:24:04 1 using System; using System.Collections.Generic; using System.ComponentModel; u ...

  7. java内存模型及分块

    转自:http://www.cnblogs.com/BangQ/p/4045954.html 1.JMM简介 2.堆和栈 3.本机内存 4.防止内存泄漏   1.JMM简介   i.内存模型概述 Ja ...

  8. 深入探讨C#中Socket一次性搞定消息发送

    转载自:http://tech.chinaunix.net/a2010/0909/1101/000001101396.shtml     [IT168 技术文档]最近浏览了几篇有关Socket发送消息 ...

  9. eclipse总是自动跳到ThreadPoolExecutor.java

    解决方法:在eclipse中选择Window->Preference->Java->Debug, 将“Suspend execution on uncaught exceptions ...

  10. librarynotfoundforlPodsAFNetworking解决放案

    http://www.it165.net/pro/html/201503/36422.html