zoukankan      html  css  js  c++  java
  • mysql 2006

    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

  • 相关阅读:
    thinkPHP 远程数据库和远程连接数据库表名大小写混合
    浏览器兼容性的问题
    input 的那些事
    jquery ui draggable失效的问题
    thinkphp在php5.6以上版本显示"No input file specified"
    ajax dataType
    DOM对象的处理
    ubuntu 16.4 中eth0添加ip地址,且可以上网
    linux 安装phpstudy
    select样式清除
  • 原文地址:https://www.cnblogs.com/zoucaitou/p/4249972.html
Copyright © 2011-2022 走看看