{"id":893,"date":"2019-07-21T22:04:53","date_gmt":"2019-07-21T14:04:53","guid":{"rendered":"http:\/\/nas1.xyz1943.net\/wordpress\/?p=890"},"modified":"2019-07-21T22:04:53","modified_gmt":"2019-07-21T14:04:53","slug":"mysql-mariadb-%e4%bf%ae%e6%94%b9%e8%b3%87%e6%96%99%e6%8f%92%e5%85%a5%e4%b8%8a%e9%99%90-max_allowed_packet","status":"publish","type":"post","link":"https:\/\/nas1.xyz1943.net\/wordpress\/2019\/07\/21\/mysql-mariadb-%e4%bf%ae%e6%94%b9%e8%b3%87%e6%96%99%e6%8f%92%e5%85%a5%e4%b8%8a%e9%99%90-max_allowed_packet\/","title":{"rendered":"MySQL \/ MariaDB \u4fee\u6539\u8cc7\u6599\u63d2\u5165\u4e0a\u9650 max_allowed_packet"},"content":{"rendered":"<blockquote>\n<p>\u5728 MySQL \/ MariaDB \u63d2\u5165\u8cc7\u6599\u6642\uff0c\u6bcf\u7b46\u8cc7\u6599\u4e5f\u6703\u6709\u9650\u5236\uff0c\u9810\u8a2d\u503c\u662f 16MB\uff0c\u5176\u5be6\u9019\u500b 16MB \u7684\u9650\u5236\u5df2\u7d93\u5f88\u5bec\u9b06\uff0c\u4e00\u822c\u60c5\u6cc1\u90fd\u6703\u5920\u7528\uff0c\u4f46\u5982\u679c\u5c07\u6a94\u6848 (\u4f8b\u5982\u5716\u7247) \u76f4\u63a5\u5132\u5b58\u5728 MySQL \u7684\u8a71\uff0c\u4fbf\u6709\u53ef\u80fd\u51fa\u73fe\u932f\u8aa4\uff0c\u7576\u7528 inert \u63d2\u5165 \u6216 update \u66f4\u65b0\u7684\u8cc7\u6599\u8d85\u904e\u9650\u5236\u7684\u8a71\uff0c\u6703\u51fa\u73fe\u4ee5\u4e0b\u932f\u8aa4\uff1a Error 1153 \u2013 Got a packet bigger than \u2018max_allowed_packet\u2019 bytes \u8981\u89e3\u6c7a\u9019\u500b\u554f\u984c\u53ef\u4ee5\u4fee\u6539 MySQL \u7684 max_allowed_packet \u8b8a\u6578\u3002 \u5728\u4fee\u6539\u524d\u53ef\u4ee5\u5148\u67e5\u770b\u76ee\u524d\u7684 max_allowed_packet \u8b8a\u6578\u7684\u6578\u503c\uff0c\u5728 CLI \u767b\u5165 MySQL: # mysql -u mysql -p \u767b\u5165 MySQL \u5f8c\u8f38\u5165\u4ee5\u4e0b\u6307\u4ee4\u67e5\u770b\uff1a \u4e0a\u9762\u7684\u6578\u503c\u662f 16MB\uff0c\u4f8b\u5982\u60f3\u52a0\u5927\u5230 32MB, \u53ef\u4ee5\u7528\u4ee5\u4e0b\u5169\u7a2e\u65b9\u6cd5\u8a2d\u5b9a\uff1a 1. \u5be6\u6642\u6539\u8b8a max_allowed_packet \u8b8a\u6578 \u9019\u500b\u65b9\u6cd5\u7684\u597d\u8655\u662f\u7acb\u5373\u751f\u6548\uff0c\u800c\u4e14\u4e0d\u7528\u91cd\u65b0\u555f\u52d5 MySQL\uff0c\u4f46\u7f3a\u9ede\u662f\u4e0b\u6b21\u91cd\u65b0\u555f\u52d5 MySQL \u5f8c\u8a2d\u5b9a\u6703\u5931\u6548\u3002\u767b\u5165 MySQL \u5f8c\uff0c\u8f38\u5165\u4ee5\u4e0b\u6307\u4ee4\uff1a 2. \u4fee\u6539 my.cnf \u4fee\u6539 my.cnf \u53ef\u4ee5\u5728\u91cd\u65b0\u555f\u52d5 MySQL \u4e5f\u4fdd\u6301\u8a2d\u5b9a\u751f\u6548\uff0c\u958b\u555f my.cnf: # vi \/etc\/my.cnf \u5728 \u6bb5\u843d\u52a0\u5165 max_allowed_packet \u7684\u8a2d\u5b9a\uff0c\u4f8b\u5982\uff1a \u6700\u5f8c\u91cd\u65b0\u555f\u52d5 MySQL\uff1a # systemctl restart mysql \u4f60\u53ef\u80fd\u611f\u8208\u8da3\u7684\u5167\u5bb9:<\/p>\n<\/blockquote>\n<p>\u5167\u5bb9\u51fa\u8655: <em><a href=\"https:\/\/www.opencli.com\/mysql\/mysqlmariadb-change-max_allowed_packet\">MySQL \/ MariaDB \u4fee\u6539\u8cc7\u6599\u63d2\u5165\u4e0a\u9650 max_allowed_packet<\/a><\/em><\/p>\n<p>\u67e5\u8a62<\/p>\n<p>show variables like &#8216;max_allowed_packet&#8217;;<\/p>\n<p>\u6539256M<\/p>\n<p><span class=\"crayon-e\">set <\/span><span class=\"crayon-m\">global<\/span> <span class=\"crayon-i\">max_allowed_packet<\/span>=<span class=\"crayon-cn\">268435456<\/span><span class=\"crayon-sy\">;<\/span><\/p>\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5728 MySQL \/ MariaDB \u63d2\u5165\u8cc7\u6599\u6642\uff0c\u6bcf\u7b46\u8cc7\u6599\u4e5f\u6703\u6709\u9650\u5236\uff0c\u9810\u8a2d\u503c\u662f 1 &hellip; <a href=\"https:\/\/nas1.xyz1943.net\/wordpress\/2019\/07\/21\/mysql-mariadb-%e4%bf%ae%e6%94%b9%e8%b3%87%e6%96%99%e6%8f%92%e5%85%a5%e4%b8%8a%e9%99%90-max_allowed_packet\/\">\u95b1\u8b80\u5168\u6587 <span class=\"meta-nav\">&rarr;<\/span><\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":[],"categories":[5],"tags":[],"_links":{"self":[{"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/posts\/893"}],"collection":[{"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/comments?post=893"}],"version-history":[{"count":0,"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/posts\/893\/revisions"}],"wp:attachment":[{"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/media?parent=893"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/categories?post=893"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nas1.xyz1943.net\/wordpress\/wp-json\/wp\/v2\/tags?post=893"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}