{"id":2460,"date":"2010-09-28T07:10:41","date_gmt":"2010-09-27T23:10:41","guid":{"rendered":"http:\/\/www.orczhou.com\/?p=2460"},"modified":"2010-09-28T07:12:08","modified_gmt":"2010-09-27T23:12:08","slug":"mysql-too-many-connections","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2010\/09\/mysql-too-many-connections\/","title":{"rendered":"MySQL: Too many connections"},"content":{"rendered":"<div class=\"mycode\">$mysql -uroot<br \/>\nERROR 1040 (00000): Too many connections<\/div>\n<p>\u4e0a\u9762\u7684\u9519\u8bef\uff0c\u4f30\u8ba1\u5f88\u591a\u4eba\u90fd\u9047\u5230\u8fc7\uff0cAurimas Mikalauskas\u5728<a href=\"http:\/\/www.mysqlperformanceblog.com\/2010\/03\/23\/too-many-connections-no-problem\/\">MySQL Performance Blog<\/a>\u5df2\u7ecf\u63d0\u5230\u4e86\u4e00\u4e2a\u89e3\u51b3\u529e\u6cd5\uff08<strong>\u751f\u4ea7\u73af\u5883\u614e\u7528\u4e4b<\/strong>\uff09\uff1a<\/p>\n<div class=\"mycode\">$gdb -p $(cat data\/mysql_sandbox5087.pid) \\<br \/>\n-ex &#8220;set max_connections=5000&#8221; -batch<\/div>\n<p>\u4e0a\u9762\u63d0\u5230\u7684\u53ea\u662f\u4e00\u4e2a\u6551\u706b\u7684\u529e\u6cd5\uff0cMySQL\u63d0\u4f9b\u4e86\u53e6\u4e00\u4e2a\u529e\u6cd5\uff0c\u53ef\u4ee5<span style=\"color:red\">\u4e00\u5b9a\u7a0b\u5ea6\u4e0a<\/span>\u907f\u514d\u4e0a\u8ff0\u95ee\u9898\u3002<\/p>\n<p>MySQL\u63d0\u4f9b\u4e86\u53c2\u6570<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/server-system-variables.html#sysvar_max_connections\">max_connections<\/a>\u63a7\u5236\u6700\u5927\u8fde\u63a5\u6570\uff0c\u8fd9\u5305\u62ec\u6240\u6709\u7528\u6237\u7684\u8fde\u63a5\u6570\u3002MySQL\u8fd8\u63d0\u4f9b\u4e86\u53e6\u4e00\u4e2a\u53c2\u6570<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/server-system-variables.html#sysvar_max_user_connections\">max_user_connections<\/a>\uff0c\u7528\u6765\u63a7\u5236<strong>\u67d0\u4e2a\u7528\u6237<\/strong>\u7684\u6700\u5927\u8fde\u63a5\u6570\u3002\u4f8b\u5982\uff0c\u5c06\u8be5\u53c2\u6570\u8bbe\u7f6e\u4e3a50\uff0c\u90a3\u4e48\u5bf9\u4e8e<strong>\u4efb\u4f55\u4e00\u4e2a\u7528\u6237<\/strong>\uff08\u5305\u62ecsuper\u6743\u9650\u7684\u7528\u6237\uff09\uff0c\u6700\u591a\u53ea\u80fd\u521b\u5efa50\u4e2a\u8fde\u63a5\u3002<!--more--><\/p>\n<p>\u4e8e\u662f\u6211\u4eec\u53ef\u4ee5\u5236\u5b9a\u4e0b\u9762\u7684\u7b56\u7565\uff1a\u5982\u679c\u7684MySQL\u67093\u4e2a\u7528\u6237\uff08\u4e0d\u5305\u62ecroot\uff09\uff0c\u5c06<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/server-system-variables.html#sysvar_max_user_connections\">max_user_connections<\/a>\u8bbe\u7f6e\u4e3a300\uff0c<a href=\"http:\/\/dev.mysql.com\/doc\/refman\/5.1\/en\/server-system-variables.html#sysvar_max_connections\">max_connections<\/a>\u8bbe\u7f6e\u4e3a1000\u3002\u914d\u7f6e\u6587\u4ef6\uff1a<\/p>\n<div class=\"mycode\">max_connections = 1000<br \/>\nmax_user_connections=300\n<\/div>\n<p>\u90a3\u4e48\u56e0\u4e3a\u53ea\u67093\u4e2a\u7528\u6237\uff0c\u5355\u4e2a\u7528\u6237\u7684\u6700\u5927\u8fde\u63a5\u6570\u662f300\uff0c\u90a3\u4e48\u6b63\u5e38\u6700\u591a\u5c31\u53ea\u6709900\u4e2a\u8fde\u63a5\uff0c\u4e5f\u5c31\u603b\u4f1a\u6709100\u4e2a\u989d\u5916\u7684\u8fde\u63a5\u7ed9root\u6765\u4f7f\u7528\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>$mysql -uroot ERROR 1040 (00000): Too many connections \u4e0a\u9762\u7684\u9519\u8bef\uff0c\u4f30\u8ba1\u5f88\u591a\u4eba\u90fd\u9047\u5230\u8fc7\uff0cAurimas Mikalauskas\u5728MySQL Performance Blog\u5df2\u7ecf\u63d0\u5230\u4e86\u4e00\u4e2a\u89e3\u51b3\u529e\u6cd5\uff08\u751f\u4ea7\u73af\u5883\u614e\u7528\u4e4b\uff09\uff1a $gdb -p $(cat data\/mysql_sandbox5087.pid) \\ -ex &#8220;set max_connections=5000&#8221; -batch \u4e0a\u9762\u63d0\u5230\u7684\u53ea\u662f\u4e00\u4e2a\u6551\u706b\u7684\u529e\u6cd5\uff0cMySQL\u63d0\u4f9b\u4e86\u53e6\u4e00\u4e2a\u529e\u6cd5\uff0c\u53ef\u4ee5\u4e00\u5b9a\u7a0b\u5ea6\u4e0a\u907f\u514d\u4e0a\u8ff0\u95ee\u9898\u3002 MySQL\u63d0\u4f9b\u4e86\u53c2\u6570max_connections\u63a7\u5236\u6700\u5927\u8fde\u63a5\u6570\uff0c\u8fd9\u5305\u62ec\u6240\u6709\u7528\u6237\u7684\u8fde\u63a5\u6570\u3002MySQL\u8fd8\u63d0\u4f9b\u4e86\u53e6\u4e00\u4e2a\u53c2\u6570max_user_connections\uff0c\u7528\u6765\u63a7\u5236\u67d0\u4e2a\u7528\u6237\u7684\u6700\u5927\u8fde\u63a5\u6570\u3002\u4f8b\u5982\uff0c\u5c06\u8be5\u53c2\u6570\u8bbe\u7f6e\u4e3a50\uff0c\u90a3\u4e48\u5bf9\u4e8e\u4efb\u4f55\u4e00\u4e2a\u7528\u6237\uff08\u5305\u62ecsuper\u6743\u9650\u7684\u7528\u6237\uff09\uff0c\u6700\u591a\u53ea\u80fd\u521b\u5efa50\u4e2a\u8fde\u63a5\u3002<\/p>\n","protected":false},"author":2,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[6],"tags":[118],"class_list":["post-2460","post","type-post","status-publish","format-standard","hentry","category-mysql","tag-mysql"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2460","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/2"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=2460"}],"version-history":[{"count":14,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2460\/revisions"}],"predecessor-version":[{"id":2486,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/2460\/revisions\/2486"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=2460"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=2460"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=2460"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}