{"id":1993,"date":"2011-04-27T00:27:44","date_gmt":"2011-04-27T00:27:44","guid":{"rendered":"http:\/\/www.icocean.com\/blog\/?p=1993"},"modified":"1970-01-01T07:00:00","modified_gmt":"1970-01-01T07:00:00","slug":"%E4%BC%98%E5%8C%96mysql%E6%95%B0%E6%8D%AE%E5%BA%93%E6%80%A7%E8%83%BD%E7%9A%84%E5%8D%81%E4%B8%AA%E5%8F%82%E6%95%B0","status":"publish","type":"post","link":"https:\/\/www.icocean.com\/blog\/?p=1993","title":{"rendered":"\u4f18\u5316mysql\u6570\u636e\u5e93\u6027\u80fd\u7684\u5341\u4e2a\u53c2\u6570"},"content":{"rendered":"<p>\u4f5c\u8005: Jun \u65e5\u671f: 2010\u5e7401\u670811\u65e5<\/p>\n<p>\u8fd9\u4e24\u5929\uff0c\u4e00\u53f0VPS\u670d\u52a1\u5668\u7684MYSQL\u8fdb\u7a0b\u7684\u7269\u7406\u5185\u5b58\uff08>700MB\uff09\u548c\u865a\u62df\u5185\u5b58(>1.4G)\u4f7f\u7528\u7387\u975e\u5e38\u9ad8(\u4e0a\u9762\u4ec5\u4ec5\u8dd1\u4e864\u4e2a\u7ad9)\u3002<\/p>\n<p>\u5f00\u59cb\u6000\u7591\u662f\u67d0\u4e2a\u7f51\u7ad9\u7a0b\u5e8f\u8bbe\u8ba1\u4e0a\u51fa\u4e86\u95ee\u9898\uff0c\u627e\u7a0b\u5e8f\u5458\u5546\u91cf\u4e86\uff0c\u6ca1\u67e5\u51fa\u95ee\u9898\uff0c\u6c57\u3002\u3002\u3002\u3002<\/p>\n<p>\u6700\u540e\u53d1\u73b0\u662f\u4e00\u4f4e\u7ea7\u9519\u8bef\uff1a<br \/><a href=\"http:\/\/www.icocean.com\/blog\/wp-content\/bo\/attachment\/201104\/1303835187_7388106d.jpg\" target=\"_blank\"><img decoding=\"async\" src=\"http:\/\/www.icocean.com\/blog\/wp-content\/bo\/attachment\/201104\/1303835187_7388106d.jpg\" class=\"insertimage\"  border=\"0\"   \/><\/a><\/p>\n<p><b>\u4f18\u5316mysql\u6570\u636e\u5e93\u6027\u80fd\u7684\u5341\u4e2a\u53c2\u6570<\/b><\/p>\n<p>(1)\u3001max_connections<br \/>\u5141\u8bb8\u7684\u540c\u65f6\u5ba2\u6237\u7684\u6570\u91cf\u3002\u589e\u52a0\u8be5\u503c\u589e\u52a0 mysqld \u8981\u6c42\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u6570\u91cf\u3002\u8fd9\u4e2a\u6570\u5b57\u5e94\u8be5\u589e\u52a0\uff0c\u5426\u5219\uff0c\u4f60\u5c06\u7ecf\u5e38\u770b\u5230 too many connections \u9519\u8bef\u3002<\/p>\n<p>(2)\u3001record_buffer<br \/>\u6bcf\u4e2a\u8fdb\u884c\u4e00\u4e2a\u987a\u5e8f\u626b\u63cf\u7684\u7ebf\u7a0b\u4e3a\u5176\u626b\u63cf\u7684\u6bcf\u5f20\u8868\u5206\u914d\u8fd9\u4e2a\u5927\u5c0f\u7684\u4e00\u4e2a\u7f13\u51b2\u533a\u3002\u5982\u679c\u4f60\u505a\u5f88\u591a\u987a\u5e8f\u626b\u63cf\uff0c\u4f60\u53ef\u80fd\u60f3\u8981\u589e\u52a0\u8be5\u503c\u3002<\/p>\n<p>(3)\u3001key_buffer_size<br \/>\u7d22\u5f15\u5757\u662f\u7f13\u51b2\u7684\u5e76\u4e14\u88ab\u6240\u6709\u7684\u7ebf\u7a0b\u5171\u4eab\u3002key_buffer_size\u662f\u7528\u4e8e\u7d22\u5f15\u5757\u7684\u7f13\u51b2\u533a\u5927\u5c0f\uff0c\u589e\u52a0\u5b83\u53ef\u5f97\u5230\u66f4\u597d\u5904\u7406\u7684\u7d22\u5f15(\u5bf9\u6240\u6709\u8bfb\u548c\u591a\u91cd\u5199)\uff0c\u5230\u4f60\u80fd\u8d1f\u62c5\u5f97\u8d77\u90a3\u6837\u591a\u3002\u5982\u679c\u4f60\u4f7f\u5b83\u592a\u5927\uff0c\u7cfb\u7edf\u5c06\u5f00\u59cb\u6362\u9875\u5e76\u4e14\u771f\u7684\u53d8\u6162\u4e86\u3002<!--more--><\/p>\n<p>(4)\u3001back_log<br \/>\u8981\u6c42mysql\u80fd\u6709\u7684\u8fde\u63a5\u6570\u91cf\u3002\u5f53\u4e3b\u8981mysql\u7ebf\u7a0b\u5728\u4e00\u4e2a\u5f88\u77ed\u65f6\u95f4\u5185\u5f97\u5230\u975e\u5e38\u591a\u7684\u8fde\u63a5\u8bf7\u6c42\uff0c\u8fd9\u5c31\u8d77\u4f5c\u7528\uff0c\u7136\u540e\u4e3b\u7ebf\u7a0b\u82b1\u4e9b\u65f6\u95f4(\u5c3d\u7ba1\u5f88\u77ed)\u68c0\u67e5\u8fde\u63a5\u5e76\u4e14\u542f\u52a8\u4e00\u4e2a\u65b0\u7ebf\u7a0b\u3002<br \/>back_log \u503c\u6307\u51fa\u5728mysql\u6682\u65f6\u505c\u6b62\u56de\u7b54\u65b0\u8bf7\u6c42\u4e4b\u524d\u7684\u77ed\u65f6\u95f4\u5185\u591a\u5c11\u4e2a\u8bf7\u6c42\u53ef\u4ee5\u88ab\u5b58\u5728\u5806\u6808\u4e2d\u3002\u53ea\u6709\u5982\u679c\u671f\u671b\u5728\u4e00\u4e2a\u77ed\u65f6\u95f4\u5185\u6709\u5f88\u591a\u8fde\u63a5\uff0c\u4f60\u9700\u8981\u589e\u52a0\u5b83\uff0c\u6362\u53e5\u8bdd\u8bf4\uff0c\u8fd9\u503c\u5bf9\u5230\u6765\u7684tcp\/ip\u8fde\u63a5\u7684\u4fa6\u542c\u961f\u5217\u7684\u5927\u5c0f\u3002\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u5728\u8fd9\u4e2a\u961f\u5217\u5927\u5c0f\u4e0a\u6709\u5b83\u81ea\u5df1\u7684\u9650\u5236\u3002\u8bd5\u56fe\u8bbe\u5b9aback_log\u9ad8\u4e8e\u4f60\u7684\u64cd\u4f5c\u7cfb\u7edf\u7684\u9650\u5236\u5c06\u662f\u65e0\u6548\u7684\u3002<br \/>\u5f53\u4f60\u89c2\u5bdf\u4f60\u7684\u4e3b\u673a\u8fdb\u7a0b\u5217\u8868\uff0c\u53d1\u73b0\u5927\u91cf 264084 &#124; unauthenticated user &#124; xxx.xxx.xxx.xxx &#124; null &#124; connect &#124; null &#124; login &#124; null \u7684\u5f85\u8fde\u63a5\u8fdb\u7a0b\u65f6\uff0c\u5c31\u8981\u52a0\u5927 back_log \u7684\u503c\u4e86\u3002<\/p>\n<p>(5)\u3001interactive_timeout<br \/>\u670d\u52a1\u5668\u5728\u5173\u95ed\u5b83\u524d\u5728\u4e00\u4e2a\u4ea4\u4e92\u8fde\u63a5\u4e0a\u7b49\u5f85\u884c\u52a8\u7684\u79d2\u6570\u3002\u4e00\u4e2a\u4ea4\u4e92\u7684\u5ba2\u6237\u88ab\u5b9a\u4e49\u4e3a\u5bf9 mysql_real_connect()\u4f7f\u7528 client_interactive \u9009\u9879\u7684\u5ba2\u6237\u3002<\/p>\n<p>(6)\u3001sort_buffer<br \/>\u6bcf\u4e2a\u9700\u8981\u8fdb\u884c\u6392\u5e8f\u7684\u7ebf\u7a0b\u5206\u914d\u8be5\u5927\u5c0f\u7684\u4e00\u4e2a\u7f13\u51b2\u533a\u3002\u589e\u52a0\u8fd9\u503c\u52a0\u901forder by\u6216group by\u64cd\u4f5c\u3002<\/p>\n<p>(7)\u3001table_cache<br \/>\u4e3a\u6240\u6709\u7ebf\u7a0b\u6253\u5f00\u8868\u7684\u6570\u91cf\u3002\u589e\u52a0\u8be5\u503c\u80fd\u589e\u52a0mysqld\u8981\u6c42\u7684\u6587\u4ef6\u63cf\u8ff0\u7b26\u7684\u6570\u91cf\u3002mysql\u5bf9\u6bcf\u4e2a\u552f\u4e00\u6253\u5f00\u7684\u8868\u9700\u89812\u4e2a\u6587\u4ef6\u63cf\u8ff0\u7b26\u3002<\/p>\n<p>(8)\u3001thread_cache_size<br \/>\u53ef\u4ee5\u590d\u7528\u7684\u4fdd\u5b58\u5728\u4e2d\u7684\u7ebf\u7a0b\u7684\u6570\u91cf\u3002\u5982\u679c\u6709\uff0c\u65b0\u7684\u7ebf\u7a0b\u4ece\u7f13\u5b58\u4e2d\u53d6\u5f97\uff0c\u5f53\u65ad\u5f00\u8fde\u63a5\u7684\u65f6\u5019\u5982\u679c\u6709\u7a7a\u95f4\uff0c\u5ba2\u6237\u7684\u7ebf\u7f6e\u5728\u7f13\u5b58\u4e2d\u3002\u5982\u679c\u6709\u5f88\u591a\u65b0\u7684\u7ebf\u7a0b\uff0c\u4e3a\u4e86\u63d0\u9ad8\u6027\u80fd\u53ef\u4ee5\u8fd9\u4e2a\u53d8\u91cf\u503c\u3002\u901a\u8fc7\u6bd4\u8f83 connections \u548c threads_created \u72b6\u6001\u7684\u53d8\u91cf\uff0c\u53ef\u4ee5\u770b\u5230\u8fd9\u4e2a\u53d8\u91cf\u7684\u4f5c\u7528\u3002<\/p>\n<p>(9)\u3001mysql\u7684\u641c\u7d22\u529f\u80fd<br \/>\u7528mysql\u8fdb\u884c\u641c\u7d22\uff0c\u76ee\u7684\u662f\u80fd\u4e0d\u5206\u5927\u5c0f\u5199\uff0c\u53c8\u80fd\u7528\u4e2d\u6587\u8fdb\u884c\u641c\u7d22<br \/>\u53ea\u9700\u8d77\u52a8mysqld\u65f6\u6307\u5b9a \u2013default-character-set=gb2312<\/p>\n<p>(10)\u3001wait_timeout<br \/>\u670d\u52a1\u5668\u5728\u5173\u95ed\u5b83\u4e4b\u524d\u5728\u4e00\u4e2a\u8fde\u63a5\u4e0a\u7b49\u5f85\u884c\u52a8\u7684\u79d2\u6570\u3002<br \/>\u6ce8\uff1a\u4e0a\u9762\u7684\u7ed3\u679c\u4e5f\u4ec5\u4ec5\u662f\u4e2a\u4eba\u4e00\u4e9b\u770b\u6cd5\uff0c\u4f60\u53ef\u4ee5\u6839\u636e\u4f60\u81ea\u5df1\u4e3b\u673a\u7684\u786c\u4ef6\u60c5\u51b5\uff08\u7279\u522b\u662f\u5185\u5b58\u5927\u5c0f\uff09\u8fdb\u4e00\u6b65\u4fee\u6539\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4f5c\u8005: Jun \u65e5\u671f: 2010\u5e7401\u670811\u65e5 \u8fd9\u4e24\u5929\uff0c\u4e00\u53f0VPS\u670d\u52a1\u5668\u7684MYSQL\u8fdb\u7a0b\u7684\u7269\u7406\u5185\u5b58\uff08>700M <a href='https:\/\/www.icocean.com\/blog\/?p=1993' class='excerpt-more'>[&#8230;]<\/a><\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[24],"tags":[366,392,1870],"class_list":["post-1993","post","type-post","status-publish","format-standard","hentry","category-lamp","tag-mysql","tag-392","tag-1870","category-24-id","post-seq-1","post-parity-odd","meta-position-corners","fix"],"amp_enabled":true,"_links":{"self":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1993","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=1993"}],"version-history":[{"count":0,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=\/wp\/v2\/posts\/1993\/revisions"}],"wp:attachment":[{"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=1993"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=1993"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.icocean.com\/blog\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=1993"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}