{"id":6378,"date":"2024-11-14T13:48:12","date_gmt":"2024-11-14T05:48:12","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6378\/"},"modified":"2024-11-14T13:48:12","modified_gmt":"2024-11-14T05:48:12","slug":"mysql%e7%9a%84%e9%bb%98%e8%ae%a4%e5%af%86%e7%a0%81%e6%98%af%e4%bb%80%e4%b9%88","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6378\/","title":{"rendered":"mysql\u7684\u9ed8\u8ba4\u5bc6\u7801\u662f\u4ec0\u4e48"},"content":{"rendered":"<blockquote><p>\n  mysql \u7684\u9ed8\u8ba4\u5bc6\u7801\u6839\u636e\u5b89\u88c5\u9009\u9879\u548c\u7248\u672c\u800c\u5f02\uff0c\u5e38\u89c1\u9ed8\u8ba4\u5bc6\u7801\u5305\u62ec\u7a7a\u5bc6\u7801\u3001&#8221;root&#8221; \u548c &#8220;mysql&#8221;\u3002\u5efa\u8bae\u5728\u9996\u6b21\u5b89\u88c5\u540e\u7acb\u5373\u66f4\u6539\u9ed8\u8ba4\u5bc6\u7801\uff0c\u4ee5\u63d0\u9ad8\u5b89\u5168\u6027\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/01\/2024080106162716934.jpg\" class=\"aligncenter\" title=\"mysql\u7684\u9ed8\u8ba4\u5bc6\u7801\u662f\u4ec0\u4e48\u63d2\u56fe\" alt=\"mysql\u7684\u9ed8\u8ba4\u5bc6\u7801\u662f\u4ec0\u4e48\u63d2\u56fe\" \/><\/p>\n<p><strong>MySQL \u9ed8\u8ba4\u5bc6\u7801<\/strong><\/p>\n<p>MySQL \u7684\u9ed8\u8ba4\u5bc6\u7801\u4e0e\u5b89\u88c5\u9009\u9879\u548c\u7248\u672c\u6709\u5173\u3002\u5728\u6ca1\u6709\u6307\u5b9a\u5bc6\u7801\u65f6\uff0c\u4e0d\u540c\u7684\u5b89\u88c5\u548c\u7248\u672c\u53ef\u80fd\u5177\u6709\u4e0d\u540c\u7684\u9ed8\u8ba4\u5bc6\u7801\u3002<\/p>\n<p><strong>\u5e38\u89c1\u9ed8\u8ba4\u5bc6\u7801<\/strong><\/p>\n<ul>\n<li> <strong>\u7a7a\u5bc6\u7801\uff1a<\/strong>\u5728\u9996\u6b21\u5b89\u88c5 MySQL \u65f6\uff0c\u5982\u679c\u672a\u6307\u5b9a\u5bc6\u7801\uff0c\u5219\u9ed8\u8ba4\u5bc6\u7801\u4e3a\u7a7a\u3002<\/li>\n<li> <strong>root\uff1a<\/strong>\u5728\u67d0\u4e9b Linux \u53d1\u884c\u7248\u4e0a\uff0cMySQL \u7684\u9ed8\u8ba4 root \u7528\u6237\u5bc6\u7801\u53ef\u80fd\u8bbe\u7f6e\u4e3a &#8220;root&#8221;\u3002<\/li>\n<li> <strong>\uff1a<\/strong>\u5728\u4e00\u4e9b\u65e7\u7248\u672c\u7684 MySQL \u4e0a\uff0c\u9ed8\u8ba4\u5bc6\u7801\u53ef\u80fd\u662f &#8220;mysql&#8221;\u3002<\/li>\n<\/ul>\n<p><strong>\u68c0\u67e5\u9ed8\u8ba4\u5bc6\u7801<\/strong><\/p>\n<p>\u8981\u68c0\u67e5\u60a8\u7684 MySQL \u5b89\u88c5\u7684\u9ed8\u8ba4\u5bc6\u7801\uff0c\u53ef\u4ee5\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\u5e76\u8fd0\u884c\u4ee5\u4e0b\u67e5\u8be2\uff1a<\/p>\n<pre>SELECT user, password FROM mysql.user WHERE user=\"root\";<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5982\u679c\u6ca1\u6709\u6307\u5b9a\u5bc6\u7801\uff0c\u5219\u67e5\u8be2\u7ed3\u679c\u7684 &#8220;password&#8221; \u5217\u5c06\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002<\/p>\n<p><strong>\u66f4\u6539\u9ed8\u8ba4\u5bc6\u7801<\/strong><\/p>\n<p>\u5f3a\u70c8\u5efa\u8bae\u5728\u9996\u6b21\u5b89\u88c5 MySQL \u540e\u5c3d\u5feb\u66f4\u6539\u9ed8\u8ba4\u5bc6\u7801\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u66f4\u6539 root \u7528\u6237\u7684\u5bc6\u7801\uff1a<\/p>\n<pre>ALTER USER 'root'@'localhost' IDENTIFIED BY 'new_password';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5176\u4e2d &#8220;new_password&#8221; \u5e94\u66ff\u6362\u4e3a\u60a8\u7684\u65b0\u5bc6\u7801\u3002<\/p>\n<p><strong>\u5176\u4ed6\u6ce8\u610f\u4e8b\u9879<\/strong><\/p>\n<ul>\n<li> <strong>\u5b89\u5168\u8003\u8651\uff1a<\/strong>\u9ed8\u8ba4\u5bc6\u7801\u4e0d\u5b89\u5168\uff0c\u5e94\u7acb\u5373\u66f4\u6539\u3002<\/li>\n<li> <strong>\u7248\u672c\u5dee\u5f02\uff1a<\/strong>MySQL \u4e0d\u540c\u7684\u7248\u672c\u53ef\u80fd\u5177\u6709\u4e0d\u540c\u7684\u9ed8\u8ba4\u5bc6\u7801\u7b56\u7565\u3002<\/li>\n<li> <strong>\u5b89\u88c5\u9009\u9879\uff1a<\/strong>\u4f7f\u7528\u4e0d\u540c\u7684\u5b89\u88c5\u9009\u9879\u53ef\u80fd\u4f1a\u5f71\u54cd\u9ed8\u8ba4\u5bc6\u7801\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u7684\u9ed8\u8ba4\u5bc6\u7801\u662f\u4ec0\u4e48\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 \u7684\u9ed8\u8ba4\u5bc6\u7801\u6839\u636e\u5b89\u88c5\u9009\u9879\u548c\u7248\u672c\u800c\u5f02\uff0c\u5e38\u89c1\u9ed8\u8ba4\u5bc6\u7801\u5305\u62ec\u7a7a\u5bc6\u7801\u3001&#8221;root&#8221; \u548c &#8220;mysql&#8221;\u3002\u5efa\u8bae\u5728\u9996\u6b21\u5b89\u88c5\u540e\u7acb\u5373\u66f4\u6539\u9ed8\u8ba4\u5bc6\u7801\uff0c\u4ee5\u63d0\u9ad8\u5b89\u5168\u6027\u3002 MySQL \u9ed8\u8ba4\u5bc6\u7801 MySQL \u7684\u9ed8\u8ba4\u5bc6\u7801\u4e0e\u5b89\u88c5\u9009\u9879\u548c\u7248\u672c\u6709\u5173\u3002\u5728\u6ca1\u6709\u6307\u5b9a\u5bc6\u7801\u65f6\uff0c\u4e0d\u540c\u7684\u5b89\u88c5\u548c\u7248\u672c\u53ef\u80fd\u5177\u6709\u4e0d\u540c\u7684\u9ed8\u8ba4\u5bc6\u7801\u3002 \u5e38\u89c1\u9ed8\u8ba4\u5bc6\u7801 \u7a7a\u5bc6\u7801\uff1a\u5728\u9996\u6b21\u5b89\u88c5 MySQL \u65f6\uff0c\u5982\u679c\u672a\u6307\u5b9a\u5bc6\u7801\uff0c\u5219\u9ed8\u8ba4\u5bc6\u7801\u4e3a\u7a7a\u3002 root\uff1a\u5728\u67d0\u4e9b Linux \u53d1\u884c\u7248\u4e0a\uff0cMySQL \u7684\u9ed8\u8ba4 root \u7528\u6237\u5bc6\u7801\u53ef\u80fd\u8bbe\u7f6e\u4e3a &#8220;root&#8221;\u3002 \uff1a\u5728\u4e00\u4e9b\u65e7\u7248\u672c\u7684 MySQL \u4e0a\uff0c\u9ed8\u8ba4\u5bc6\u7801\u53ef\u80fd\u662f &#8220;mysql&#8221;\u3002 \u68c0\u67e5\u9ed8\u8ba4\u5bc6\u7801 \u8981\u68c0\u67e5\u60a8\u7684 MySQL \u5b89\u88c5\u7684\u9ed8\u8ba4\u5bc6\u7801\uff0c\u53ef\u4ee5\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\u5e76\u8fd0\u884c\u4ee5\u4e0b\u67e5\u8be2\uff1a SELECT user, password FROM mysql.user WHERE user=&#8221;root&#8221;; \u767b\u5f55\u540e\u590d\u5236 \u5982\u679c\u6ca1\u6709\u6307\u5b9a\u5bc6\u7801\uff0c\u5219\u67e5\u8be2\u7ed3\u679c\u7684 &#8220;password&#8221; \u5217\u5c06\u4e3a\u7a7a\u5b57\u7b26\u4e32\u3002 \u66f4\u6539\u9ed8\u8ba4\u5bc6\u7801 \u5f3a\u70c8\u5efa\u8bae\u5728\u9996\u6b21\u5b89\u88c5 MySQL \u540e\u5c3d\u5feb\u66f4\u6539\u9ed8\u8ba4\u5bc6\u7801\u3002\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u66f4\u6539 root \u7528\u6237\u7684\u5bc6\u7801\uff1a ALTER USER &#8216;root&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;new_password&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u5176\u4e2d &#8220;new_password&#8221; [&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-6378","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6378","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=6378"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6378\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6378"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6378"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6378"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}