{"id":5523,"date":"2024-11-14T11:11:46","date_gmt":"2024-11-14T03:11:46","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5523\/"},"modified":"2024-11-14T11:11:46","modified_gmt":"2024-11-14T03:11:46","slug":"mysql%e4%b8%8d%e8%83%bd%e5%90%af%e5%8a%a8%e6%80%8e%e4%b9%88%e5%8a%9e","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5523\/","title":{"rendered":"mysql\u4e0d\u80fd\u542f\u52a8\u600e\u4e48\u529e"},"content":{"rendered":"<blockquote><p>\n  mysql \u65e0\u6cd5\u542f\u52a8\u7684\u539f\u56e0\u548c\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a\u68c0\u67e5\u8fdb\u7a0b\u662f\u5426\u5df2\u542f\u52a8\u3002\u68c0\u67e5\u7aef\u53e3\u51b2\u7a81\u5e76\u4fee\u6539\u914d\u7f6e\u3002\u786e\u4fdd mysql \u6570\u636e\u76ee\u5f55\u5177\u6709\u6b63\u786e\u6743\u9650\u3002\u68c0\u67e5 mysql \u914d\u7f6e\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\u3002\u68c0\u67e5 mysql \u65e5\u5fd7\u6587\u4ef6\u4e2d\u7684\u9519\u8bef\u3002\u68c0\u67e5\u670d\u52a1\u5668\u5185\u5b58\u662f\u5426\u5145\u8db3\u3002\u68c0\u67e5 mysql \u6570\u636e\u76ee\u5f55\u662f\u5426\u6709\u8db3\u591f\u7684\u78c1\u76d8\u7a7a\u95f4\u3002\u4fee\u590d\u635f\u574f\u7684\u6570\u636e\u5e93\u6587\u4ef6\u3002\u68c0\u67e5\u670d\u52a1\u5668\u8d44\u6e90\u662f\u5426\u4e0d\u8db3\u5e76\u5173\u95ed\u4e0d\u5fc5\u8981\u7684\u8fdb\u7a0b\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/29\/2024052907452822663.jpg\" class=\"aligncenter\" title=\"mysql\u4e0d\u80fd\u542f\u52a8\u600e\u4e48\u529e\u63d2\u56fe\" alt=\"mysql\u4e0d\u80fd\u542f\u52a8\u600e\u4e48\u529e\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL\u65e0\u6cd5\u542f\u52a8\uff1a\u6545\u969c\u6392\u9664\u6307\u5357<\/strong><\/p>\n<p><strong>\u539f\u56e0\u548c\u89e3\u51b3\u65b9\u6848\uff1a<\/strong><\/p>\n<p><strong>1. \u8fdb\u7a0b\u5df2\u7ecf\u542f\u52a8<\/strong><\/p>\n<ul>\n<li>\n<p>\u68c0\u67e5\u8fdb\u7a0b\u662f\u5426\u5df2\u7ecf\u542f\u52a8\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>ps -ef |grep mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\n<p>\u5982\u679c\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u8f93\u51fa\uff0c\u5219\u8fdb\u7a0b\u5df2\u5728\u8fd0\u884c\uff1a<\/p>\n<pre>mysql      12345  1234  0 12:34 pts\/0    00:00:00 mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>2. \u7aef\u53e3\u51b2\u7a81<\/strong><\/p>\n<ul>\n<li>\n<p>\u68c0\u67e5MySQL\u662f\u5426\u7ed1\u5b9a\u5230\u53e6\u4e00\u4e2a\u7aef\u53e3\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>netstat -anp |grep mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\u5982\u679c\u770b\u5230\u8f93\u51fa\u663e\u793aMySQL\u7ed1\u5b9a\u5230\u4e00\u4e2a\u4e0d\u540c\u7684\u7aef\u53e3\uff0c\u8bf7\u4fee\u6539MySQL\u914d\u7f6e\u6216\u66f4\u65b0\u7aef\u53e3\u53f7\u3002<\/li>\n<\/ul>\n<p><strong>3. \u6587\u4ef6\u6743\u9650<\/strong><\/p>\n<ul>\n<li>\n<p>\u786e\u4fddMySQL\u6570\u636e\u76ee\u5f55\u7684\u6743\u9650\u6b63\u786e\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>ls -l \/var\/lib\/mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\u786e\u4fdd\u7528\u6237\u62e5\u6709\u76ee\u5f55\u7684\u6240\u6709\u6743\u5e76\u5177\u6709\u8bfb\u5199\u6743\u9650\u3002<\/li>\n<\/ul>\n<p><strong>4. \u914d\u7f6e\u6587\u4ef6\u9519\u8bef<\/strong><\/p>\n<ul>\n<li>\n<p>\u68c0\u67e5MySQL\u914d\u7f6e\u6587\u4ef6my.cnf\u662f\u5426\u5b58\u5728\u9519\u8bef\u3002\u5e38\u89c1\u7684\u9519\u8bef\u5305\u62ec\uff1a<\/p>\n<ul>\n<li>\u9519\u8bef\u7684\u7aef\u53e3\u53f7<\/li>\n<li>\u65e0\u6548\u7684bind-address<\/li>\n<li>\u4e22\u5931\u7684\u914d\u7f6e\u6587\u4ef6\u884c<\/li>\n<\/ul>\n<\/li>\n<\/ul>\n<p><strong>5. \u65e5\u5fd7\u6587\u4ef6\u9519\u8bef<\/strong><\/p>\n<ul>\n<li>\u68c0\u67e5MySQL\u65e5\u5fd7\u6587\u4ef6\u4e2d\u7684\u9519\u8bef\u3002\u5bf9\u4e8eLinux\u7cfb\u7edf\uff0c\u901a\u5e38\u4f4d\u4e8e\/var\/log\/mysql\/error.log\u3002<\/li>\n<li>\u65e5\u5fd7\u6587\u4ef6\u53ef\u4ee5\u6307\u793a\u95ee\u9898\u7684\u6839\u672c\u539f\u56e0\u3002<\/li>\n<\/ul>\n<p><strong>6. \u5185\u5b58\u4e0d\u8db3<\/strong><\/p>\n<ul>\n<li>\u68c0\u67e5\u670d\u52a1\u5668\u662f\u5426\u6709\u8db3\u591f\u7684\u5185\u5b58\u3002MySQL\u9700\u8981\u4e00\u5b9a\u91cf\u7684\u5185\u5b58\u624d\u80fd\u8fd0\u884c\u3002<\/li>\n<li>\u589e\u52a0\u670d\u52a1\u5668\u7684\u5185\u5b58\u6216\u964d\u4f4eMySQL\u7684\u5185\u5b58\u4f7f\u7528\u7387\u3002<\/li>\n<\/ul>\n<p><strong>7. \u786c\u76d8\u7a7a\u95f4\u4e0d\u8db3<\/strong><\/p>\n<ul>\n<li>\u68c0\u67e5MySQL\u6570\u636e\u76ee\u5f55\u662f\u5426\u6709\u8db3\u591f\u7684\u78c1\u76d8\u7a7a\u95f4\u3002<\/li>\n<li>\u6e05\u7406\u65e7\u6570\u636e\u6216\u589e\u52a0\u78c1\u76d8\u7a7a\u95f4\u3002<\/li>\n<\/ul>\n<p><strong>8. \u635f\u574f\u7684\u6570\u636e\u5e93\u6587\u4ef6<\/strong><\/p>\n<ul>\n<li>\u635f\u574f\u7684\u6570\u636e\u5e93\u6587\u4ef6\u53ef\u80fd\u4f1a\u963b\u6b62MySQL\u542f\u52a8\u3002<\/li>\n<li>\u5c1d\u8bd5\u4f7f\u7528mysqlcheck\u5de5\u5177\u4fee\u590d\u6570\u636e\u5e93\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<p><strong>9. \u7cfb\u7edf\u8d44\u6e90\u4e0d\u8db3<\/strong><\/p>\n<ul>\n<li>\u68c0\u67e5\u670d\u52a1\u5668\u7684CPU\u548c\u5185\u5b58\u4f7f\u7528\u7387\u3002<\/li>\n<li>\u5982\u679c\u670d\u52a1\u5668\u8d44\u6e90\u4e0d\u8db3\uff0cMySQL\u53ef\u80fd\u4f1a\u65e0\u6cd5\u542f\u52a8\u3002<\/li>\n<li>\u5173\u95ed\u4e0d\u5fc5\u8981\u7684\u8fdb\u7a0b\u6216\u589e\u52a0\u670d\u52a1\u5668\u8d44\u6e90\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u4e0d\u80fd\u542f\u52a8\u600e\u4e48\u529e\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>mysql \u65e0\u6cd5\u542f\u52a8\u7684\u539f\u56e0\u548c\u89e3\u51b3\u65b9\u6848\u5305\u62ec\uff1a\u68c0\u67e5\u8fdb\u7a0b\u662f\u5426\u5df2\u542f\u52a8\u3002\u68c0\u67e5\u7aef\u53e3\u51b2\u7a81\u5e76\u4fee\u6539\u914d\u7f6e\u3002\u786e\u4fdd mysql \u6570\u636e\u76ee\u5f55\u5177\u6709\u6b63\u786e\u6743\u9650\u3002\u68c0\u67e5 mysql \u914d\u7f6e\u6587\u4ef6\u662f\u5426\u5b58\u5728\u9519\u8bef\u3002\u68c0\u67e5 mysql \u65e5\u5fd7\u6587\u4ef6\u4e2d\u7684\u9519\u8bef\u3002\u68c0\u67e5\u670d\u52a1\u5668\u5185\u5b58\u662f\u5426\u5145\u8db3\u3002\u68c0\u67e5 mysql \u6570\u636e\u76ee\u5f55\u662f\u5426\u6709\u8db3\u591f\u7684\u78c1\u76d8\u7a7a\u95f4\u3002\u4fee\u590d\u635f\u574f\u7684\u6570\u636e\u5e93\u6587\u4ef6\u3002\u68c0\u67e5\u670d\u52a1\u5668\u8d44\u6e90\u662f\u5426\u4e0d\u8db3\u5e76\u5173\u95ed\u4e0d\u5fc5\u8981\u7684\u8fdb\u7a0b\u3002 MySQL\u65e0\u6cd5\u542f\u52a8\uff1a\u6545\u969c\u6392\u9664\u6307\u5357 \u539f\u56e0\u548c\u89e3\u51b3\u65b9\u6848\uff1a 1. \u8fdb\u7a0b\u5df2\u7ecf\u542f\u52a8 \u68c0\u67e5\u8fdb\u7a0b\u662f\u5426\u5df2\u7ecf\u542f\u52a8\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a ps -ef |grep mysql \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u770b\u5230\u7c7b\u4f3c\u8fd9\u6837\u7684\u8f93\u51fa\uff0c\u5219\u8fdb\u7a0b\u5df2\u5728\u8fd0\u884c\uff1a mysql 12345 1234 0 12:34 pts\/0 00:00:00 mysql \u767b\u5f55\u540e\u590d\u5236 2. \u7aef\u53e3\u51b2\u7a81 \u68c0\u67e5MySQL\u662f\u5426\u7ed1\u5b9a\u5230\u53e6\u4e00\u4e2a\u7aef\u53e3\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a netstat -anp |grep mysql \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u770b\u5230\u8f93\u51fa\u663e\u793aMySQL\u7ed1\u5b9a\u5230\u4e00\u4e2a\u4e0d\u540c\u7684\u7aef\u53e3\uff0c\u8bf7\u4fee\u6539MySQL\u914d\u7f6e\u6216\u66f4\u65b0\u7aef\u53e3\u53f7\u3002 3. \u6587\u4ef6\u6743\u9650 \u786e\u4fddMySQL\u6570\u636e\u76ee\u5f55\u7684\u6743\u9650\u6b63\u786e\u3002\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a ls -l \/var\/lib\/mysql \u767b\u5f55\u540e\u590d\u5236 \u786e\u4fdd\u7528\u6237\u62e5\u6709\u76ee\u5f55\u7684\u6240\u6709\u6743\u5e76\u5177\u6709\u8bfb\u5199\u6743\u9650\u3002 4. \u914d\u7f6e\u6587\u4ef6\u9519\u8bef \u68c0\u67e5MySQL\u914d\u7f6e\u6587\u4ef6my.cnf\u662f\u5426\u5b58\u5728\u9519\u8bef\u3002\u5e38\u89c1\u7684\u9519\u8bef\u5305\u62ec\uff1a \u9519\u8bef\u7684\u7aef\u53e3\u53f7 \u65e0\u6548\u7684bind-address \u4e22\u5931\u7684\u914d\u7f6e\u6587\u4ef6\u884c 5. \u65e5\u5fd7\u6587\u4ef6\u9519\u8bef [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5523","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5523","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5523"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5523\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5523"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5523"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5523"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}