{"id":5425,"date":"2024-11-14T10:22:29","date_gmt":"2024-11-14T02:22:29","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5425\/"},"modified":"2024-11-14T10:22:29","modified_gmt":"2024-11-14T02:22:29","slug":"%e5%90%af%e5%8a%a8mysql%e6%8a%a5%e9%94%99%e6%80%8e%e4%b9%88%e8%a7%a3%e5%86%b3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5425\/","title":{"rendered":"\u542f\u52a8mysql\u62a5\u9519\u600e\u4e48\u89e3\u51b3"},"content":{"rendered":"<blockquote><p>\n  \u542f\u52a8 mysql \u65f6\u62a5\u9519\u7684\u89e3\u51b3\u65b9\u6cd5\u6709\uff1a1. \u786e\u5b9a\u9519\u8bef\u4fe1\u606f\uff1b2. \u68c0\u67e5 mysql \u65e5\u5fd7\uff1b3. \u68c0\u67e5 mysql \u7aef\u53e3\uff1b4. \u68c0\u67e5 mysql \u914d\u7f6e\u6587\u4ef6\uff1b5. \u5c1d\u8bd5\u5b89\u5168\u6a21\u5f0f\uff1b6. \u91cd\u65b0\u5b89\u88c5 mysql\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/28\/2024052812242682644.jpg\" class=\"aligncenter\" title=\"\u542f\u52a8mysql\u62a5\u9519\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" alt=\"\u542f\u52a8mysql\u62a5\u9519\u600e\u4e48\u89e3\u51b3\u63d2\u56fe\" \/><\/p>\n<p><strong>\u542f\u52a8 MySQL \u65f6\u62a5\u9519\u7684\u89e3\u51b3\u65b9\u6cd5<\/strong><\/p>\n<p><strong>1. \u786e\u5b9a\u9519\u8bef\u4fe1\u606f<\/strong><\/p>\n<p>\u542f\u52a8 MySQL \u65f6\u51fa\u73b0\u7684\u9519\u8bef\u4fe1\u606f\u901a\u5e38\u5305\u542b\u6709\u7528\u7684\u7ebf\u7d22\uff0c\u4f8b\u5982\u9519\u8bef\u4ee3\u7801\u548c\u9519\u8bef\u6d88\u606f\u3002\u51c6\u786e\u8bb0\u5f55\u4e0b\u8fd9\u4e9b\u4fe1\u606f\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<p><strong>2. \u68c0\u67e5 MySQL \u65e5\u5fd7<\/strong><\/p>\n<p>MySQL \u65e5\u5fd7\u901a\u5e38\u5305\u542b\u6709\u5173\u542f\u52a8\u9519\u8bef\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\u53ef\u4ee5\u5728 MySQL \u5b89\u88c5\u76ee\u5f55\uff08\u4f8b\u5982 \/var\/log\/\/error.log\uff09\u4e2d\u627e\u5230\u8fd9\u4e9b\u65e5\u5fd7\u3002<\/p>\n<p><strong>3. \u68c0\u67e5 MySQL \u7aef\u53e3<\/strong><\/p>\n<p>MySQL \u9ed8\u8ba4\u5728 3306 \u7aef\u53e3\u4e0a\u76d1\u542c\u3002\u786e\u4fdd\u7aef\u53e3\u672a\u88ab\u5176\u4ed6\u8fdb\u7a0b\u5360\u7528\u3002\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\uff1a<\/p>\n<pre>netstat -an | grep 3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u68c0\u67e5 MySQL \u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<p>MySQL \u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4f4d\u4e8e \/etc\/mysql\/my.cnf\uff09\u5305\u542b\u6709\u5173 MySQL \u5b9e\u4f8b\u914d\u7f6e\u7684\u4fe1\u606f\u3002\u68c0\u67e5\u914d\u7f6e\u6587\u4ef6\u4e2d\u662f\u5426\u5b58\u5728\u8bed\u6cd5\u9519\u8bef\u6216\u65e0\u6548\u7684\u8bbe\u7f6e\u3002<\/p>\n<p><strong>5. \u5c1d\u8bd5\u5b89\u5168\u6a21\u5f0f<\/strong><\/p>\n<p>\u5982\u679c\u5176\u4ed6\u6b65\u9aa4\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u53ef\u4ee5\u5c1d\u8bd5\u4ee5\u5b89\u5168\u6a21\u5f0f\u542f\u52a8 MySQL\u3002\u8fd9\u5c06\u7981\u7528\u63d2\u4ef6\u5e76\u52a0\u8f7d\u6700\u5c0f\u914d\u7f6e\u3002\u8981\u542f\u52a8 MySQL \u5b89\u5168\u6a21\u5f0f\uff0c\u8bf7\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mysqld_safe --skip-grant-tables<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u91cd\u65b0\u5b89\u88c5 MySQL<\/strong><\/p>\n<p>\u5982\u679c\u4e0a\u8ff0\u6b65\u9aa4\u90fd\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u5219\u53ef\u80fd\u9700\u8981\u91cd\u65b0\u5b89\u88c5 MySQL\u3002\u8fd9\u5c06\u5220\u9664\u6240\u6709\u73b0\u6709\u6570\u636e\uff0c\u56e0\u6b64\u5728\u6267\u884c\u6b64\u6b65\u9aa4\u4e4b\u524d\u5907\u4efd\u6570\u636e\u975e\u5e38\u91cd\u8981\u3002<\/p>\n<p><strong>\u5176\u4ed6\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u5df2\u6388\u4e88 MySQL \u8fdb\u7a0b\u8db3\u591f\u7684\u6743\u9650\u3002<\/li>\n<li>\u68c0\u67e5\u9632\u706b\u5899\u89c4\u5219\u4ee5\u786e\u4fdd\u5141\u8bb8 MySQL \u8bbf\u95ee\u5fc5\u8981\u7684\u7aef\u53e3\u3002<\/li>\n<li>\u4f7f\u7528 MySQL \u63d0\u4f9b\u7684\u8c03\u8bd5\u5de5\u5177\uff0c\u4f8b\u5982 mysqldump \u6216 mysqlcheck\uff0c\u6765\u8fdb\u4e00\u6b65\u8bca\u65ad\u95ee\u9898\u3002<\/li>\n<li>\u5982\u679c\u4ecd\u7136\u65e0\u6cd5\u89e3\u51b3\u95ee\u9898\uff0c\u53ef\u4ee5\u5bfb\u6c42 MySQL \u793e\u533a\u7684\u5e2e\u52a9\u6216\u8054\u7cfb MySQL \u652f\u6301\u56e2\u961f\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u542f\u52a8\u62a5\u9519\u600e\u4e48\u89e3\u51b3\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>\u542f\u52a8 mysql \u65f6\u62a5\u9519\u7684\u89e3\u51b3\u65b9\u6cd5\u6709\uff1a1. \u786e\u5b9a\u9519\u8bef\u4fe1\u606f\uff1b2. \u68c0\u67e5 mysql \u65e5\u5fd7\uff1b3. \u68c0\u67e5 mysql \u7aef\u53e3\uff1b4. \u68c0\u67e5 mysql \u914d\u7f6e\u6587\u4ef6\uff1b5. \u5c1d\u8bd5\u5b89\u5168\u6a21\u5f0f\uff1b6. \u91cd\u65b0\u5b89\u88c5 mysql\u3002 \u542f\u52a8 MySQL \u65f6\u62a5\u9519\u7684\u89e3\u51b3\u65b9\u6cd5 1. \u786e\u5b9a\u9519\u8bef\u4fe1\u606f \u542f\u52a8 MySQL \u65f6\u51fa\u73b0\u7684\u9519\u8bef\u4fe1\u606f\u901a\u5e38\u5305\u542b\u6709\u7528\u7684\u7ebf\u7d22\uff0c\u4f8b\u5982\u9519\u8bef\u4ee3\u7801\u548c\u9519\u8bef\u6d88\u606f\u3002\u51c6\u786e\u8bb0\u5f55\u4e0b\u8fd9\u4e9b\u4fe1\u606f\u975e\u5e38\u91cd\u8981\u3002 2. \u68c0\u67e5 MySQL \u65e5\u5fd7 MySQL \u65e5\u5fd7\u901a\u5e38\u5305\u542b\u6709\u5173\u542f\u52a8\u9519\u8bef\u7684\u66f4\u591a\u8be6\u7ec6\u4fe1\u606f\u3002\u53ef\u4ee5\u5728 MySQL \u5b89\u88c5\u76ee\u5f55\uff08\u4f8b\u5982 \/var\/log\/\/error.log\uff09\u4e2d\u627e\u5230\u8fd9\u4e9b\u65e5\u5fd7\u3002 3. \u68c0\u67e5 MySQL \u7aef\u53e3 MySQL \u9ed8\u8ba4\u5728 3306 \u7aef\u53e3\u4e0a\u76d1\u542c\u3002\u786e\u4fdd\u7aef\u53e3\u672a\u88ab\u5176\u4ed6\u8fdb\u7a0b\u5360\u7528\u3002\u53ef\u4ee5\u901a\u8fc7\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\u6765\u68c0\u67e5\uff1a netstat -an | grep 3306 \u767b\u5f55\u540e\u590d\u5236 4. \u68c0\u67e5 MySQL \u914d\u7f6e\u6587\u4ef6 MySQL \u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u4f4d\u4e8e \/etc\/mysql\/my.cnf\uff09\u5305\u542b\u6709\u5173 MySQL [&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-5425","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5425","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=5425"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5425\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5425"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5425"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5425"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}