码迷,mamicode.com
首页 > 数据库 > 详细

mysql 2006

时间:2015-01-26 13:36:46      阅读:188      评论:0      收藏:0      [点我收藏+]

标签:

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

标签:

原文地址:http://www.cnblogs.com/zoucaitou/p/4249972.html

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!