doumenshi1475 2013-07-08 09:24
浏览 59
已采纳

当数据变大时,MySQL插入查询失败

I have already followed the question:Data Limit on MySQL DB Insert I was unable to solve it with the limited info. I am using WAMP. I have numerous Rich Text editors and 4 images which are being sent over to another page by a POST request. After a certain threshold limit, the query is failing. Is there a way around?

EDIT: while displaying the query string it seems that I am able to retrieve every bit of data that was sent via POST. I am quite sure that it is DB related. Images are being stored as a BLOB.

EDIT #2: Error showing is "MySQL server has gone away".

  • 写回答

3条回答 默认 最新

  • drtwqc3744 2013-07-08 09:45
    关注

    You may be violating the max_allowed_packet setting. See here for more data.

    Quote,

    If you are using the mysql client program, its default max_allowed_packet variable is 16MB.

    If you are uploading uncompressed images, this value is fairly easy to reach.

    Also, it would be great if you could name the specific database interface class that you use (PDO? mysql_? mysqli_?), as different classes handle errors differently. It could just as well not handle an oversized packet situation at all.

    P.S.: You should really be checking your logs for the specific error you encounter. The first place to look for would be /var/log/mysql/error.log (could vary depending on your env)

    Update: mysql_error() returned "MySQL server has gone away"

    From the manual pages for the error: "You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld receives a packet that is too large or out of order, it assumes that something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can increase the query limit by setting the server's max_allowed_packet variable, which has a default value of 1MB. You may also need to increase the maximum packet size on the client end..."

    (quote courtesy of @Colin Morelli)

    本回答被题主选为最佳回答 , 对您是否有帮助呢?
    评论
查看更多回答(2条)

报告相同问题?

悬赏问题

  • ¥15 公交车和无人机协同运输
  • ¥15 stm32代码移植没反应
  • ¥15 matlab基于pde算法图像修复,为什么只能对示例图像有效
  • ¥100 连续两帧图像高速减法
  • ¥15 组策略中的计算机配置策略无法下发
  • ¥15 如何绘制动力学系统的相图
  • ¥15 对接wps接口实现获取元数据
  • ¥20 给自己本科IT专业毕业的妹m找个实习工作
  • ¥15 用友U8:向一个无法连接的网络尝试了一个套接字操作,如何解决?
  • ¥30 我的代码按理说完成了模型的搭建、训练、验证测试等工作(标签-网络|关键词-变化检测)