{"id":177095,"date":"2024-11-08T13:18:20","date_gmt":"2024-11-08T05:18:20","guid":{"rendered":"https:\/\/server.hk\/cnblog\/177095\/"},"modified":"2024-11-08T13:18:20","modified_gmt":"2024-11-08T05:18:20","slug":"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a41037-sql%e7%8b%80%e6%85%8b%ef%bc%9ahy001%ef%bc%88er_outofmemory%ef%bc%89%e5%85%a7%e5%ad%98%e4%b8%8d%e8%b6%b3%ef%bc%9b%e9%87%8d%e6%96%b0","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/177095\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa41037 &#8211; SQL\u72c0\u614b\uff1aHY001\uff08ER_OUTOFMEMORY\uff09\u5167\u5b58\u4e0d\u8db3\uff1b\u91cd\u65b0\u555f\u52d5\u4f3a\u670d\u5668\u5f8c\u91cd\u8a66\uff08\u9700\u8981%d\u5b57\u7bc0\uff09"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a41037-sql%e7%8b%80%e6%85%8b%ef%bc%9ahy001%ef%bc%88er_outofmemory%ef%bc%89%e5%85%a7%e5%ad%98%e4%b8%8d%e8%b6%b3-yjIBUtfvQv\">\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa41037 &#8211; SQL\u72c0\u614b\uff1aHY001\uff08ER_OUTOFMEMORY\uff09\u5167\u5b58\u4e0d\u8db3<\/h1>\n<p>\u5728\u4f7f\u7528MySQL\u6578\u64da\u5eab\u6642\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u932f\u8aa41037\uff0c\u8a72\u932f\u8aa4\u7684SQL\u72c0\u614b\u70baHY001\uff0c\u8868\u793a\u5167\u5b58\u4e0d\u8db3\u3002\u9019\u901a\u5e38\u662f\u7531\u65bcMySQL\u4f3a\u670d\u5668\u5728\u8655\u7406\u8acb\u6c42\u6642\u8d85\u51fa\u4e86\u53ef\u7528\u5167\u5b58\u7684\u9650\u5236\u3002\u672c\u6587\u5c07\u63a2\u8a0e\u6b64\u932f\u8aa4\u7684\u539f\u56e0\u3001\u5f71\u97ff\u4ee5\u53ca\u5982\u4f55\u6709\u6548\u5730\u4fee\u5fa9\u5b83\u3002<\/p>\n<h2 id=\"%e9%8c%af%e8%aa%a41037%e7%9a%84%e5%8e%9f%e5%9b%a0-yjIBUtfvQv\">\u932f\u8aa41037\u7684\u539f\u56e0<\/h2>\n<p>\u932f\u8aa41037\u901a\u5e38\u767c\u751f\u5728\u4ee5\u4e0b\u5e7e\u7a2e\u60c5\u6cc1\u4e0b\uff1a<\/p>\n<ul>\n<li><strong>\u67e5\u8a62\u904e\u65bc\u8907\u96dc\uff1a<\/strong>\u7576\u57f7\u884c\u7684SQL\u67e5\u8a62\u904e\u65bc\u8907\u96dc\uff0c\u6d89\u53ca\u5927\u91cf\u6578\u64da\u6642\uff0cMySQL\u53ef\u80fd\u6703\u6d88\u8017\u904e\u591a\u7684\u5167\u5b58\u3002<\/li>\n<li><strong>\u914d\u7f6e\u4e0d\u7576\uff1a<\/strong>MySQL\u7684\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u67d0\u4e9b\u5167\u5b58\u53c3\u6578\u8a2d\u7f6e\u4e0d\u7576\uff0c\u53ef\u80fd\u5c0e\u81f4\u5167\u5b58\u4e0d\u8db3\u3002<\/li>\n<li><strong>\u6578\u64da\u91cf\u904e\u5927\uff1a<\/strong>\u96a8\u8457\u6578\u64da\u5eab\u4e2d\u6578\u64da\u91cf\u7684\u589e\u52a0\uff0cMySQL\u6240\u9700\u7684\u5167\u5b58\u4e5f\u6703\u96a8\u4e4b\u589e\u52a0\u3002<\/li>\n<li><strong>\u4e26\u767c\u8acb\u6c42\u904e\u591a\uff1a<\/strong>\u7576\u540c\u6642\u6709\u591a\u500b\u8acb\u6c42\u9032\u5165MySQL\u4f3a\u670d\u5668\u6642\uff0c\u53ef\u80fd\u6703\u5c0e\u81f4\u5167\u5b58\u8cc7\u6e90\u7684\u7af6\u722d\u3002<\/li>\n<\/ul>\n<h2 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9%e9%8c%af%e8%aa%a41037-yjIBUtfvQv\">\u5982\u4f55\u4fee\u5fa9\u932f\u8aa41037<\/h2>\n<p>\u4fee\u5fa9MySQL\u932f\u8aa41037\u7684\u65b9\u6cd5\u6709\u591a\u7a2e\uff0c\u4ee5\u4e0b\u662f\u4e00\u4e9b\u5e38\u898b\u7684\u89e3\u6c7a\u65b9\u6848\uff1a<\/p>\n<h3 id=\"1-%e5%a2%9e%e5%8a%a0mysql%e7%9a%84%e5%85%a7%e5%ad%98%e9%99%90%e5%88%b6-yjIBUtfvQv\">1. \u589e\u52a0MySQL\u7684\u5167\u5b58\u9650\u5236<\/h3>\n<p>\u60a8\u53ef\u4ee5\u901a\u904e\u4fee\u6539MySQL\u7684\u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u662fmy.cnf\u6216my.ini\uff09\u4f86\u589e\u52a0\u5167\u5b58\u9650\u5236\u3002\u4ee5\u4e0b\u662f\u4e00\u4e9b\u91cd\u8981\u7684\u53c3\u6578\uff1a<\/p>\n<pre><code>\n[mysqld]\ninnodb_buffer_pool_size = 1G  # \u6839\u64da\u4f3a\u670d\u5668\u7684\u5167\u5b58\u5927\u5c0f\u8abf\u6574\nmax_connections = 200          # \u6839\u64da\u9700\u8981\u8abf\u6574\u6700\u5927\u9023\u63a5\u6578\ntmp_table_size = 64M          # \u8abf\u6574\u81e8\u6642\u8868\u7684\u5927\u5c0f\nmax_heap_table_size = 64M     # \u8abf\u6574\u6700\u5927\u5806\u8868\u5927\u5c0f\n<\/code><\/pre>\n<p>\u4fee\u6539\u5f8c\uff0c\u8acb\u91cd\u555fMySQL\u670d\u52d9\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\u3002<\/p>\n<h3 id=\"2-%e5%84%aa%e5%8c%96sql%e6%9f%a5%e8%a9%a2-yjIBUtfvQv\">2. \u512a\u5316SQL\u67e5\u8a62<\/h3>\n<p>\u6aa2\u67e5\u4e26\u512a\u5316\u60a8\u7684SQL\u67e5\u8a62\uff0c\u78ba\u4fdd\u5b83\u5011\u4e0d\u6703\u6d88\u8017\u904e\u591a\u7684\u5167\u5b58\u3002\u53ef\u4ee5\u8003\u616e\u4ee5\u4e0b\u5e7e\u9ede\uff1a<\/p>\n<ul>\n<li>\u4f7f\u7528\u7d22\u5f15\u4f86\u52a0\u901f\u67e5\u8a62\u3002<\/li>\n<li>\u907f\u514d\u4f7f\u7528SELECT *\uff0c\u800c\u662f\u9078\u64c7\u9700\u8981\u7684\u5217\u3002<\/li>\n<li>\u4f7f\u7528LIMIT\u4f86\u9650\u5236\u8fd4\u56de\u7684\u884c\u6578\u3002<\/li>\n<\/ul>\n<h3 id=\"3-%e6%aa%a2%e6%9f%a5%e4%b8%a6%e6%b8%85%e7%90%86%e6%95%b8%e6%93%9a%e5%ba%ab-yjIBUtfvQv\">3. \u6aa2\u67e5\u4e26\u6e05\u7406\u6578\u64da\u5eab<\/h3>\n<p>\u5b9a\u671f\u6aa2\u67e5\u6578\u64da\u5eab\uff0c\u522a\u9664\u4e0d\u5fc5\u8981\u7684\u6578\u64da\u548c\u8868\uff0c\u9019\u6a23\u53ef\u4ee5\u6e1b\u5c11\u5167\u5b58\u7684\u4f7f\u7528\u3002\u60a8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0bSQL\u8a9e\u53e5\u4f86\u522a\u9664\u4e0d\u518d\u9700\u8981\u7684\u6578\u64da\uff1a<\/p>\n<pre><code>\nDELETE FROM your_table WHERE condition;\n<\/code><\/pre>\n<h3 id=\"4-%e5%a2%9e%e5%8a%a0%e4%bc%ba%e6%9c%8d%e5%99%a8%e5%85%a7%e5%ad%98-yjIBUtfvQv\">4. \u589e\u52a0\u4f3a\u670d\u5668\u5167\u5b58<\/h3>\n<p>\u5982\u679c\u60a8\u7684\u4f3a\u670d\u5668\u5167\u5b58\u4e0d\u8db3\uff0c\u8003\u616e\u5347\u7d1a\u4f3a\u670d\u5668\u7684\u5167\u5b58\u914d\u7f6e\u3002\u9019\u5c07\u6709\u52a9\u65bc\u63d0\u9ad8MySQL\u7684\u6027\u80fd\uff0c\u4e26\u6e1b\u5c11\u51fa\u73fe\u5167\u5b58\u4e0d\u8db3\u932f\u8aa4\u7684\u6a5f\u6703\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-yjIBUtfvQv\">\u7e3d\u7d50<\/h2>\n<p>MySQL\u932f\u8aa41037\uff08HY001\uff09\u901a\u5e38\u662f\u7531\u65bc\u5167\u5b58\u4e0d\u8db3\u5f15\u8d77\u7684\uff0c\u89e3\u6c7a\u6b64\u554f\u984c\u9700\u8981\u5f9e\u591a\u500b\u65b9\u9762\u5165\u624b\uff0c\u5305\u62ec\u589e\u52a0\u5167\u5b58\u9650\u5236\u3001\u512a\u5316\u67e5\u8a62\u3001\u6e05\u7406\u6578\u64da\u5eab\u4ee5\u53ca\u5347\u7d1a\u4f3a\u670d\u5668\u5167\u5b58\u3002\u901a\u904e\u9019\u4e9b\u65b9\u6cd5\uff0c\u60a8\u53ef\u4ee5\u6709\u6548\u5730\u6e1b\u5c11\u6b64\u932f\u8aa4\u7684\u767c\u751f\uff0c\u78ba\u4fdd\u6578\u64da\u5eab\u7684\u7a69\u5b9a\u904b\u884c\u3002\u5982\u679c\u60a8\u9700\u8981\u66f4\u9ad8\u6548\u7684\u89e3\u6c7a\u65b9\u6848\uff0c\u53ef\u4ee5\u8003\u616e\u4f7f\u7528<a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a>\u6216<a href=\"https:\/\/server.hk\">\u96f2\u4f3a\u670d\u5668<\/a>\u4f86\u63d0\u5347\u6027\u80fd\u548c\u7a69\u5b9a\u6027\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u5fa9MySQL\u932f\u8aa41037\uff08HY001\uff09\u5167\u5b58\u4e0d\u8db3\u7684\u65b9\u6cd5\uff0c\u5305\u62ec\u91cd\u65b0\u555f\u52d5\u4f3a\u670d\u5668\u548c\u8abf\u6574\u5167\u5b58\u914d\u7f6e\uff0c\u78ba\u4fdd\u6578\u64da\u5eab\u7a69\u5b9a\u904b\u884c\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-177095","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177095","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=177095"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177095\/revisions"}],"predecessor-version":[{"id":177096,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177095\/revisions\/177096"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=177095"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=177095"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=177095"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}