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. 5 Common Interview Mistakes that Could Cost You Your Dream Job (and How to Avoid Them)--ref

    There have been many articles on our site on software testing interviews. That is because, we, as IT ...

  2. Windows 7系统下局域网文件共享设置方法

    今天给家里增添了一台组装机,小试了一下win7局域网文件共享功能,很爽的说. 记录一下实现方法: 1.关闭防火墙 2.启用共享. 控制面板 – 网络和共享中心 – 更改高级共享设置,将图中的几个选项选 ...

  3. mac os 终端提示 you have new mail

    这里的信息可能是由于所做的什么操作触发了发邮件的事件, 系统发送的邮件提醒. 我遇到的原因是由于运行 cron , 由于权限所导致了发邮件的事件提醒. Last login: Tue Apr 26 0 ...

  4. jQuery Validate 插件

    >>>>>>>>>>>>>>>>>>>>>>>>> ...

  5. Js的History对象

    History回顾 window.history表示window对象的历史记录 window.history的简单回顾 历史记录中前进/后退,移动到指定历史记录点 window.history.bac ...

  6. ASP.NET MVC 自我总结的便捷开发实例

    前言 工作了这么久了,接触ASP.NET MVC已经很久了,一直都想总结一下它的一些实用的,经常使用的一些技巧,但是因为一直都很懒,也不想总结,所以一直都没有好好写出来,趁着现在有这种冲劲,那么就先把 ...

  7. EnumWindows 使用

    转载自csdn:http://blog.csdn.net/hairi/article/details/548064   EnumWindows 用来列举屏幕上所有顶层窗口. MSDN原话: The E ...

  8. 7第七章联接和APPLY运算符(转载)

    7第七章联接和APPLY运算符 原文链接 本文由豆约翰博客备份专家远程一键发布

  9. SQL语句操作文件

    -----先开启命令exec sp_configure 'show advanced options', 1; reconfigure; exec sp_configure 'xp_cmdshell' ...

  10. A题笔记(4)

    No. 1384 这题没啥 不过网考成绩出了,发现我的口语分数相较其他人还挺高的~~~哈哈哈 Code::Blocks 有时在程序运行结束后,.exe 并没有结束,因而之后无论怎么调试和修改代码,运行 ...