{"id":1120,"date":"2022-09-21T08:11:46","date_gmt":"2022-09-21T00:11:46","guid":{"rendered":"https:\/\/usei.cn\/?p=1120"},"modified":"2022-09-21T08:28:37","modified_gmt":"2022-09-21T00:28:37","slug":"%e4%bf%ae%e6%94%b9mysql-root%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/usei.cn\/index.php\/2022\/09\/21\/%e4%bf%ae%e6%94%b9mysql-root%e5%af%86%e7%a0%81\/","title":{"rendered":"\u4fee\u6539Mysql root\u5bc6\u7801"},"content":{"rendered":"\n<p>\u5fd8\u8bb0root \u5bc6\u7801\uff0c\u53ef\u767b\u5f55\u670d\u52a1\u5668\uff0c<\/p>\n\n\n\n<h3 class=\"wp-block-heading\">1.\u5f00\u542f\u672c\u5730\u8df3\u8fc7\u6388\u6743<\/h3>\n\n\n\n<p>\u6253\u5f00mysql\u7684\u914d\u7f6e\/etc\/my.cnf \u6587\u4ef6\uff0c\u7136\u540e\u5728\u91cc\u9762\u627e\u5230 [mysqld] \u8fd9\u4e00\u9879\uff0c\u7136\u540e\u5728\u8be5\u914d\u7f6e\u9879\u4e0b\u6dfb\u52a0 skip-grant-tables \u8fd9\u4e2a\u914d\u7f6e\uff0c\u7136\u540e\u4fdd\u5b58\u6587\u4ef6\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>&#91;mysqld]\nskip-grant-tables<\/code><\/pre>\n\n\n\n<h3 class=\"wp-block-heading\">2.\u91cd\u542f\u670d\u52a1<\/h3>\n\n\n\n<h3 class=\"wp-block-heading\">\u514d\u5bc6\u767b\u5f55MySQL<\/h3>\n\n\n\n<p>\u7136\u540e\u518d\u6b21\u8fdb\u5165\u5230\u7ec8\u7aef\u5f53\u4e2d\uff0c\u6572\u5165 mysql -u root -p \u547d\u4ee4\u7136\u540e\u56de\u8f66\uff0c\u5f53\u9700\u8981\u8f93\u5165\u5bc6\u7801\u65f6\uff0c\u76f4\u63a5\u6309enter\u952e\uff0c\u4fbf\u53ef\u4ee5\u4e0d\u7528\u5bc6\u7801\u767b\u5f55\u5230\u6570\u636e\u5e93\u5f53\u4e2d<\/p>\n\n\n\n<p><\/p>\n\n\n\n<h3 class=\"wp-block-heading\">\u4e94\u3001\u4fee\u6539\u9ed8\u8ba4\u7684\u5bc6\u7801<\/h3>\n\n\n\n<p>\u4f7f\u7528 set password for &#8216;username&#8217;@&#8217;host&#8217; = password(&#8216;newpassword&#8217;) \u547d\u4ee4\u4fee\u6539\u65b0\u7684\u5bc6\u7801\u3002<\/p>\n\n\n\n<pre class=\"wp-block-code\"><code>update user set password=PASSWORD(\"123456\") where user='root';<\/code><\/pre>\n\n\n\n<p>\u5982\u679c\u5728\u6267\u884c\u8be5\u6b65\u9aa4\u7684\u65f6\u5019\u51fa\u73b0ERROR 1290 (HY000): The MySQL server is running with the &#8211;skip-grant-tables option so it cannot execute this statement \u9519\u8bef\u3002\u5219\u6267\u884c\u4e0b flush privileges \u547d\u4ee4\uff0c\u518d\u6267\u884c\u8be5\u547d\u4ee4\u5373\u53ef\u3002<br><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5fd8\u8bb0root \u5bc6\u7801\uff0c\u53ef\u767b\u5f55\u670d\u52a1\u5668\uff0c 1.\u5f00\u542f\u672c\u5730\u8df3\u8fc7\u6388\u6743 \u6253\u5f00mysql\u7684\u914d\u7f6e\/etc\/my.cnf \u6587\u4ef6\uff0c\u7136 [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[76],"tags":[],"class_list":["post-1120","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/posts\/1120","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/comments?post=1120"}],"version-history":[{"count":8,"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/posts\/1120\/revisions"}],"predecessor-version":[{"id":1128,"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/posts\/1120\/revisions\/1128"}],"wp:attachment":[{"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/media?parent=1120"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/categories?post=1120"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/usei.cn\/index.php\/wp-json\/wp\/v2\/tags?post=1120"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}