{"id":3172,"date":"2012-06-27T13:48:36","date_gmt":"2012-06-27T05:48:36","guid":{"rendered":"http:\/\/jpuyy.com\/?p=3172"},"modified":"2012-10-09T21:36:27","modified_gmt":"2012-10-09T13:36:27","slug":"enlarge-mysql-max-allowed-packet-value","status":"publish","type":"post","link":"https:\/\/jpuyy.com\/?p=3172","title":{"rendered":"\u52a0\u5927mysql\u7684max_allowed_packet\u503c"},"content":{"rendered":"<p>\u4eca\u5929\u5728\u5b89\u88c5confluence\u7684team calendars\u63d2\u4ef6\u7684\u65f6\u5019\uff0c\u6b7b\u6d3b\u5b89\u88c5\u4e0d\u4e0a\u53bb\uff0c\u770b\u65e5\u5fd7\u6587\u4ef6\u63d0\u793a<\/p>\n<p>Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4521890 &gt; 1048576). You can change this value on the server by setting the max_allowed_packet&#8217; variable.<\/p>\n<p>\u6240\u4ee5\u52a0\u5927mysql\u7684max_allowed_packet\u503c<\/p>\n<p>\u53ef\u4ee5\u7f16\u8f91my.cnf\u6765\u4fee\u6539\uff0c\u5728[mysqld]\u6bb5\u6216\u8005mysql\u7684server\u914d\u7f6e\u6bb5\u8fdb\u884c\u4fee\u6539\u3002<br \/>\nmax_allowed_packet = 20M<\/p>\n<p>max_allowed_packet \u53c2\u6570\u7684\u4f5c\u7528\u662f\uff0c\u7528\u6765\u63a7\u5236\u5176\u901a\u4fe1\u7f13\u51b2\u533a\u7684\u6700\u5927\u957f\u5ea6<br \/>\n\u5982\u679c\u627e\u4e0d\u5230my.cnf\u53ef\u4ee5\u901a\u8fc7<\/p>\n<pre>mysql --help | grep my.cnf<\/pre>\n<p>mysql\u6839\u636e\u914d\u7f6e\u6587\u4ef6\u4f1a\u9650\u5236server\u63a5\u53d7\u7684\u6570\u636e\u5305\u5927\u5c0f\u3002<\/p>\n<p>\u6709\u65f6\u5019\u5927\u7684\u63d2\u5165\u548c\u66f4\u65b0\u4f1a\u88abmax_allowed_packet \u53c2\u6570\u9650\u5236\u6389\uff0c\u5bfc\u81f4\u5931\u8d25\u3002<\/p>\n<p>\u67e5\u770b\u5f53\u524d\u914d\u7f6e<\/p>\n<pre>show VARIABLES like '%max_allowed_packet%';<\/pre>\n<p>\u663e\u793a\u7684\u7ed3\u679c\u4e3a\uff1a<\/p>\n<p>+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+<br \/>\n| Variable_name | Value |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+<br \/>\n| max_allowed_packet | 1048576 |<br \/>\n+&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;<\/p>\n<p>\u4ee5\u4e0a\u8bf4\u660e\u5f53\u524d\u7684\u914d\u7f6e\u662f\uff1a1M<\/p>\n<p>\u540e\u6765\u6539\u621020M\uff0c\u5c31\u6210\u529f\u5b89\u88c5\u4e86\u90a3\u4e2ateam calendars\u63d2\u4ef6\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4eca\u5929\u5728\u5b89\u88c5confluence\u7684team calendars\u63d2\u4ef6\u7684\u65f6\u5019\uff0c\u6b7b\u6d3b\u5b89\u88c5\u4e0d\u4e0a\u53bb\uff0c\u770b\u65e5\u5fd7\u6587\u4ef6\u63d0\u793a Caused by: com.mysql.jdbc.PacketTooBigException: Packet for query is too large (4521890 &gt; 1048576). You can change this value on the server by setting the max_allowed_packet&#8217; variable. \u6240\u4ee5\u52a0\u5927mysql\u7684max_allowed_packet\u503c \u53ef\u4ee5\u7f16\u8f91my.cnf\u6765\u4fee\u6539\uff0c\u5728[mysqld]\u6bb5\u6216\u8005mysql\u7684server\u914d\u7f6e\u6bb5\u8fdb\u884c\u4fee\u6539\u3002 max_allowed_packet = 20M max_allowed_packet \u53c2\u6570\u7684\u4f5c\u7528\u662f\uff0c\u7528\u6765\u63a7\u5236\u5176\u901a\u4fe1\u7f13\u51b2\u533a\u7684\u6700\u5927\u957f\u5ea6 \u5982\u679c\u627e\u4e0d\u5230my.cnf\u53ef\u4ee5\u901a\u8fc7 mysql &#8211;help | grep my.cnf mysql\u6839\u636e\u914d\u7f6e\u6587\u4ef6\u4f1a\u9650\u5236server\u63a5\u53d7\u7684\u6570\u636e\u5305\u5927\u5c0f\u3002 \u6709\u65f6\u5019\u5927\u7684\u63d2\u5165\u548c\u66f4\u65b0\u4f1a\u88abmax_allowed_packet \u53c2\u6570\u9650\u5236\u6389\uff0c\u5bfc\u81f4\u5931\u8d25\u3002 \u67e5\u770b\u5f53\u524d\u914d\u7f6e show VARIABLES like &#8216;%max_allowed_packet%&#8217;; \u663e\u793a\u7684\u7ed3\u679c\u4e3a\uff1a +&#8212;&#8212;&#8212;&#8212;&#8212;&#8212;&#8211;+&#8212;&#8212;&#8212;+ | Variable_name | Value | [&hellip;]<\/p>\n","protected":false},"author":3,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[65],"tags":[23],"class_list":["post-3172","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-summary"],"_links":{"self":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/3172","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/users\/3"}],"replies":[{"embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=3172"}],"version-history":[{"count":4,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/3172\/revisions"}],"predecessor-version":[{"id":4039,"href":"https:\/\/jpuyy.com\/index.php?rest_route=\/wp\/v2\/posts\/3172\/revisions\/4039"}],"wp:attachment":[{"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=3172"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=3172"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/jpuyy.com\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=3172"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}