{"id":97,"date":"2025-10-10T12:54:30","date_gmt":"2025-10-10T04:54:30","guid":{"rendered":"http:\/\/hmuseab.tstatic.top\/?p=97"},"modified":"2025-10-10T12:54:32","modified_gmt":"2025-10-10T04:54:32","slug":"mysql8-0%e4%bf%ae%e6%94%b9root%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/muse.lzink.icu\/?p=97","title":{"rendered":"MySql8.0\u4fee\u6539root\u5bc6\u7801"},"content":{"rendered":"\n<h1 class=\"wp-block-heading\">MySql8.0\u4fee\u6539root\u5bc6\u7801<\/h1>\n\n\n\n<blockquote class=\"wp-block-quote is-layout-flow wp-block-quote-is-layout-flow\">\n<p class=\"wp-block-paragraph\">\u539f\u521b \u4e8e 2019-06-20 12:11:04 \u53d1\u5e03 \u00b7 7.8w \u9605\u8bfb \u00b7 126 \u00b7 292 \u00b7 CC 4.0 BY-SA\u7248\u6743 \u7248\u6743\u58f0\u660e\uff1a\u672c\u6587\u4e3a\u535a\u4e3b\u539f\u521b\u6587\u7ae0\uff0c\u9075\u5faa CC 4.0 BY-SA \u7248\u6743\u534f\u8bae\uff0c\u8f6c\u8f7d\u8bf7\u9644\u4e0a\u539f\u6587\u51fa\u5904\u94fe\u63a5\u548c\u672c\u58f0\u660e\u3002 \u6587\u7ae0\u94fe\u63a5\uff1a<a href=\"https:\/\/blog.csdn.net\/wolf131721\/article\/details\/93004013\">https:\/\/blog.csdn.net\/wolf131721\/article\/details\/93004013<\/a><\/p>\n<\/blockquote>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>MySQL 5.7<\/strong> \u7684\u7248\u672c\uff0c\u56e0\u4e3a\u5728user\u8868\u4e2d\u6ca1\u6709password\u5b57\u6bb5\uff0c\u4e00\u76f4\u4f7f\u7528\u4e0b\u8fb9\u7684\u65b9\u5f0f\u6765\u4fee\u6539root\u5bc6\u7801<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">use mysql; <br>update user set authentication_string = password(\u201croot\u201d) where user = \u201croot\u201d;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u73b0\u5728\u8981\u7528MySQL8.0.11\u7248\u672c\uff0c\u88c5\u597dMySQL\u540e\u7528\u4e0a\u8fb9\u65b9\u6cd5\u4fee\u6539\u5bc6\u7801\uff0c\u4e00\u76f4\u62a5\u9519\u3002\u540e\u6765\u53bb\u6389password()\u51fd\u6570\u540e\uff0c\u6ca1\u6709\u62a5\u9519\uff0c\u4f46\u662f\u8f93\u5165\u5bc6\u7801\u65f6\u4e0d\u5bf9\u3002<\/p>\n\n\n\n<p class=\"wp-block-paragraph\">\u67e5\u9605\u540e\u624d\u77e5\u9053\u5728mysql 5.7.9\u4ee5\u540e\u5e9f\u5f03\u4e86password\u5b57\u6bb5\u548cpassword()\u51fd\u6570\uff1bauthentication_string:\u5b57\u6bb5\u8868\u793a\u7528\u6237\u5bc6\u7801\uff0c\u800cauthentication_string\u5b57\u6bb5\u4e0b\u53ea\u80fd\u662fmysql\u52a0\u5bc6\u540e\u768441\u4f4d\u5b57\u7b26\u4e32\u5bc6\u7801\u3002\u6240\u4ee5\u9700\u8981\u7528\u4e00\u4e0b\u65b9\u5f0f\u6765\u4fee\u6539root\u5bc6\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ALTER user 'root'@'localhost' IDENTIFIED BY 'newpassword';<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>MySql \u4ece8.0<\/strong> \u5f00\u59cb\u4fee\u6539\u5bc6\u7801\u6709\u4e86\u53d8\u5316\uff0c\u5728user\u8868\u52a0\u4e86\u5b57\u6bb5authentication_string\uff0c\u4fee\u6539\u5bc6\u7801\u524d\u5148\u68c0\u67e5authentication_string\u662f\u5426\u4e3a\u7a7a<\/p>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>1\u3001\u5982\u679c\u4e0d\u4e3a\u7a7a<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">use mysql;&nbsp;<br> <br>update user set authentication_string='' where user='root';--\u5c06\u5b57\u6bb5\u7f6e\u4e3a\u7a7a<br> <br>ALTER&nbsp;user&nbsp;'root'@'localhost'&nbsp;IDENTIFIED&nbsp;BY&nbsp;'root';--\u4fee\u6539\u5bc6\u7801\u4e3aroot<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\"><strong>2\u3001\u5982\u679c\u4e3a\u7a7a\uff0c\u76f4\u63a5\u4fee\u6539<\/strong><\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ALTER user 'root'@'localhost' IDENTIFIED BY 'root';--\u4fee\u6539\u5bc6\u7801\u4e3aroot<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u5982\u679c\u51fa\u73b0\u5982\u4e0b\u9519\u8bef<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ERROR 1290 (HY000): The MySQL server is running with the --skip-grant-ta<strong>bles option so it cannot execute this statement<\/strong><br>mysql&gt; GRANT ALL PRIVILEGES ON *.* TO IDENTIFIED BY '123' WITH GRANT OPT<strong>ION;<\/strong><\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u9700\u8981\u6267\u884c<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">flush privileges;<\/pre>\n\n\n\n<p class=\"wp-block-paragraph\">\u7136\u540e\u518d\u6267\u884c<\/p>\n\n\n\n<pre class=\"wp-block-preformatted\">ALTER user 'root'@'localhost' IDENTIFIED BY 'root';--\u4fee\u6539\u5bc6\u7801\u4e3aroot<\/pre>\n","protected":false},"excerpt":{"rendered":"<p>MySql8.0\u4fee\u6539root\u5bc6\u7801 \u539f\u521b \u4e8e 2019-06-20 12:11:04 \u53d1\u5e03 \u00b7 7.8w \u9605\u8bfb  [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[1],"tags":[],"class_list":["post-97","post","type-post","status-publish","format-standard","hentry","category-uncategorized"],"_links":{"self":[{"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=\/wp\/v2\/posts\/97","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=97"}],"version-history":[{"count":1,"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions"}],"predecessor-version":[{"id":98,"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=\/wp\/v2\/posts\/97\/revisions\/98"}],"wp:attachment":[{"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=97"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=97"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/muse.lzink.icu\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=97"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}