{"id":7137,"date":"2024-11-14T14:04:27","date_gmt":"2024-11-14T06:04:27","guid":{"rendered":"https:\/\/fwq.ai\/blog\/7137\/"},"modified":"2024-11-14T14:04:27","modified_gmt":"2024-11-14T06:04:27","slug":"mysql-%e9%87%8d%e8%a3%85%e5%90%8e%e6%97%a0%e6%b3%95%e7%99%bb%e5%bd%95%ef%bc%8c%e5%8e%9f%e5%af%86%e7%a0%81%e6%97%a0%e6%95%88%e6%80%8e%e4%b9%88%e5%8a%9e%ef%bc%9f","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/7137\/","title":{"rendered":"MySQL \u91cd\u88c5\u540e\u65e0\u6cd5\u767b\u5f55\uff0c\u539f\u5bc6\u7801\u65e0\u6548\u600e\u4e48\u529e\uff1f"},"content":{"rendered":"<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/001\/246\/273\/173050819685258.jpg\" class=\"aligncenter\" title=\"MySQL \u91cd\u88c5\u540e\u65e0\u6cd5\u767b\u5f55\uff0c\u539f\u5bc6\u7801\u65e0\u6548\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" alt=\"MySQL \u91cd\u88c5\u540e\u65e0\u6cd5\u767b\u5f55\uff0c\u539f\u5bc6\u7801\u65e0\u6548\u600e\u4e48\u529e\uff1f\u63d2\u56fe\" \/><\/p>\n<p><strong> \u5bc6\u7801\u95ee\u9898<\/strong><\/p>\n<p>\u7528\u6237\u9047\u5230\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u5373\u5728\u670d\u52a1\u5668\u4e0a\u91cd\u65b0\u5b89\u88c5 mysql \u540e\uff0c\u8f93\u5165\u539f\u5bc6\u7801\u65e0\u6cd5\u767b\u5f55\u3002\u5373\u4f7f\u91cd\u65b0\u5b89\u88c5\uff0c\u7cfb\u7edf\u4ecd\u7136\u8981\u6c42\u8f93\u5165\u5bc6\u7801\u3002<\/p>\n<p><strong>\u539f\u56e0\u5206\u6790<\/strong><\/p>\n<p>\u6b64\u95ee\u9898\u901a\u5e38\u662f\u7531\u4e8e\u7f3a\u5c11 my.conf \u6587\u4ef6\u5f15\u8d77\u7684\u3002my.conf \u6587\u4ef6\u5305\u542b mysql \u914d\u7f6e\u4fe1\u606f\uff0c\u5305\u62ec\u5bc6\u7801\u7b49\u3002<\/p>\n<p><strong>\u89e3\u51b3\u65b9\u6848<\/strong><\/p>\n<p><strong>\u4f7f\u7528\u5b89\u5168\u6a21\u5f0f\u8fdb\u5165<\/strong><\/p>\n<ol>\n<li>\u505c\u6b62 mysql \u670d\u52a1\uff1aservice mysql stop<\/li>\n<li>\u4ee5\u5b89\u5168\u6a21\u5f0f\u542f\u52a8 mysql\uff1amysqld_safe &#8211;skip-grant-tables &amp;<\/li>\n<\/ol>\n<p><strong>\u514d\u5bc6\u7801\u767b\u5f55<\/strong><\/p>\n<ol>\n<li>\u4f7f\u7528 root \u7528\u6237\u514d\u5bc6\u7801\u767b\u5f55\uff1amysql -u root<\/li>\n<li>\u5207\u6362\u5230 mysql \u6570\u636e\u5e93\uff1ause mysql ;<\/li>\n<\/ol>\n<p><strong>\u91cd\u7f6e\u5bc6\u7801<\/strong><\/p>\n<ol>\n<li>\u5237\u65b0\u6743\u9650\uff1aflush privileges;<\/li>\n<li>\n<p>\u8bbe\u7f6e root \u7528\u6237\u7684\u65b0\u5bc6\u7801\uff1a<\/p>\n<pre>SET PASSWORD FOR 'root'@'localhost' = '\u5bc6\u7801'<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\u518d\u6b21\u5237\u65b0\u6743\u9650\uff1aflush privileges;<\/li>\n<\/ol>\n<p>\u8fd9\u5c06\u91cd\u7f6e root \u7528\u6237\u7684\u5bc6\u7801\uff0c\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528\u65b0\u5bc6\u7801\u767b\u5f55 mysql\u3002<\/p>\n<p>\u4ee5\u4e0a\u5c31\u662fMySQL \u91cd\u88c5\u540e\u65e0\u6cd5\u767b\u5f55\uff0c\u539f\u5bc6\u7801\u65e0\u6548\u600e\u4e48\u529e\uff1f\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>\u5bc6\u7801\u95ee\u9898 \u7528\u6237\u9047\u5230\u4e86\u4e00\u4e2a\u95ee\u9898\uff0c\u5373\u5728\u670d\u52a1\u5668\u4e0a\u91cd\u65b0\u5b89\u88c5 mysql \u540e\uff0c\u8f93\u5165\u539f\u5bc6\u7801\u65e0\u6cd5\u767b\u5f55\u3002\u5373\u4f7f\u91cd\u65b0\u5b89\u88c5\uff0c\u7cfb\u7edf\u4ecd\u7136\u8981\u6c42\u8f93\u5165\u5bc6\u7801\u3002 \u539f\u56e0\u5206\u6790 \u6b64\u95ee\u9898\u901a\u5e38\u662f\u7531\u4e8e\u7f3a\u5c11 my.conf \u6587\u4ef6\u5f15\u8d77\u7684\u3002my.conf \u6587\u4ef6\u5305\u542b mysql \u914d\u7f6e\u4fe1\u606f\uff0c\u5305\u62ec\u5bc6\u7801\u7b49\u3002 \u89e3\u51b3\u65b9\u6848 \u4f7f\u7528\u5b89\u5168\u6a21\u5f0f\u8fdb\u5165 \u505c\u6b62 mysql \u670d\u52a1\uff1aservice mysql stop \u4ee5\u5b89\u5168\u6a21\u5f0f\u542f\u52a8 mysql\uff1amysqld_safe &#8211;skip-grant-tables &amp; \u514d\u5bc6\u7801\u767b\u5f55 \u4f7f\u7528 root \u7528\u6237\u514d\u5bc6\u7801\u767b\u5f55\uff1amysql -u root \u5207\u6362\u5230 mysql \u6570\u636e\u5e93\uff1ause mysql ; \u91cd\u7f6e\u5bc6\u7801 \u5237\u65b0\u6743\u9650\uff1aflush privileges; \u8bbe\u7f6e root \u7528\u6237\u7684\u65b0\u5bc6\u7801\uff1a SET PASSWORD FOR &#8216;root&#8217;@&#8217;localhost&#8217; = &#8216;\u5bc6\u7801&#8217; \u767b\u5f55\u540e\u590d\u5236 \u518d\u6b21\u5237\u65b0\u6743\u9650\uff1aflush privileges; \u8fd9\u5c06\u91cd\u7f6e root \u7528\u6237\u7684\u5bc6\u7801\uff0c\u73b0\u5728\u53ef\u4ee5\u4f7f\u7528\u65b0\u5bc6\u7801\u767b\u5f55 mysql\u3002 \u4ee5\u4e0a\u5c31\u662fMySQL \u91cd\u88c5\u540e\u65e0\u6cd5\u767b\u5f55\uff0c\u539f\u5bc6\u7801\u65e0\u6548\u600e\u4e48\u529e\uff1f\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-7137","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7137","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=7137"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/7137\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=7137"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=7137"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=7137"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}