﻿{"id":330,"date":"2010-08-26T14:55:59","date_gmt":"2010-08-26T06:55:59","guid":{"rendered":"http:\/\/nick.workao.org\/index.php\/nocategory\/330"},"modified":"2024-09-18T15:02:18","modified_gmt":"2024-09-18T07:02:18","slug":"mysql-%e5%bf%98%e8%ae%b0root%e5%af%86%e7%a0%81%ef%bc%8c%e9%87%8d%e7%bd%ae%e6%96%b9%e6%b3%95%ef%bc%8clinux%e5%92%8cwindows%e5%8f%af%e8%a1%8c","status":"publish","type":"post","link":"https:\/\/nick.txtcc.com\/index.php\/other\/330","title":{"rendered":"mysql \u5fd8\u8bb0ROOT\u5bc6\u7801\uff0c\u91cd\u7f6e\u65b9\u6cd5\uff0cLINUX\u548cWINDOWS\u53ef\u884c"},"content":{"rendered":"<ol>\n<li>\u505c\u6b62mysqld\uff1b\nsudo \/etc\/init.d\/mysql stop\n(\u60a8\u53ef\u80fd\u6709\u5176\u5b83\u7684\u65b9\u6cd5,\u603b\u4e4b\u505c\u6b62mysqld\u7684\u8fd0\u884c\u5c31\u53ef\u4ee5\u4e86)<\/li>\n<li>\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8MySQL\uff0c\u4ee5\u4e0d\u68c0\u67e5\u6743\u9650\u7684\u65b9\u5f0f\u542f\u52a8\uff1b\nmysqld &#8211;skip-grant-tables &#038;<\/li>\n<li>\u7136\u540e\u7528\u7a7a\u5bc6\u7801\u65b9\u5f0f\u4f7f\u7528root\u7528\u6237\u767b\u5f55 MySQL\uff1b\nmysql -u root<\/li>\n<li>\u4fee\u6539root\u7528\u6237\u7684\u5bc6\u7801\uff1b\nmysql> update mysql.user set password=PASSWORD(&#8216;newpassword&#8217;) where User=&#8217;root&#8217;;\nmysql> flush privileges;\nmysql> quit\n\u91cd\u65b0\u542f\u52a8MySQL\n\/etc\/init.d\/mysql restart\n\u5c31\u53ef\u4ee5\u4f7f\u7528\u65b0\u5bc6\u7801 newpassword \u767b\u5f55\u4e86\u3002<\/li>\n<\/ol>\n<p>8.0\u7248\u672c<\/p>\n<p>\u5df2\u6709\u5bc6\u7801\uff1a<\/p>\n<p>use mysql;<\/p>\n<p>update user set authentication_string=&#8221; where user=&#8217;root&#8217;;&#8211;\u5c06\u5b57\u6bb5\u7f6e\u4e3a\u7a7a<\/p>\n<p>ALTER user &#8216;root&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;root&#8217;;&#8211;\u4fee\u6539\u5bc6\u7801\u4e3aroot<\/p>\n<p>\u5bc6\u7801\u4e3a\u7a7a\uff1a<\/p>\n<p>ALTER user &#8216;root&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;root&#8217;;&#8211;\u4fee\u6539\u5bc6\u7801\u4e3aroot<\/p>","protected":false},"excerpt":{"rendered":"<p>\u505c\u6b62mysqld\uff1b sudo \/etc\/init.d\/mysql stop (\u60a8\u53ef\u80fd\u6709\u5176\u5b83\u7684\u65b9\u6cd5,\u603b\u4e4b\u505c\u6b62mysqld\u7684\u8fd0\u884c\u5c31\u53ef\u4ee5\u4e86) \u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8MySQL\uff0c\u4ee5\u4e0d\u68c0\u67e5\u6743\u9650\u7684\u65b9\u5f0f\u542f\u52a8\uff1b mysqld&#46;&#46;&#46;<\/p>","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[100,209,208],"class_list":["post-330","post","type-post","status-publish","format-standard","hentry","category-other","tag-mysql","tag-password","tag-root"],"_links":{"self":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/330","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/comments?post=330"}],"version-history":[{"count":2,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/330\/revisions"}],"predecessor-version":[{"id":2745,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/posts\/330\/revisions\/2745"}],"wp:attachment":[{"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/media?parent=330"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/categories?post=330"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/nick.txtcc.com\/index.php\/wp-json\/wp\/v2\/tags?post=330"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}