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 有了解d3和topogram.js库的吗?有偿请教
  • ¥100 任意维数的K均值聚类
  • ¥15 stamps做sbas-insar,时序沉降图怎么画
  • ¥15 unity第一人称射击小游戏,有demo,在原脚本的基础上进行修改以达到要求
  • ¥15 买了个传感器,根据商家发的代码和步骤使用但是代码报错了不会改,有没有人可以看看
  • ¥15 关于#Java#的问题,如何解决?
  • ¥15 加热介质是液体,换热器壳侧导热系数和总的导热系数怎么算
  • ¥100 嵌入式系统基于PIC16F882和热敏电阻的数字温度计
  • ¥15 cmd cl 0x000007b
  • ¥20 BAPI_PR_CHANGE how to add account assignment information for service line