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

  • 相关阅读:
    分页精度
    abp zero core 启动vue项目
    swagger 配置错误
    .net core 3.0配置跨域
    .net core 3.0 swagger
    .net core 3.0一个记录request和respose的中间件
    .net Core3.0 +Nlog+Sqlserver
    .net core 3.0+unit of work (一)
    .NetCore 3.0迁移遇到的各种问题
    open xml 导出excel遇到的问题
  • 原文地址:https://www.cnblogs.com/zoucaitou/p/4249972.html
Copyright © 2011-2022 走看看