{"id":17,"date":"2025-09-17T09:50:57","date_gmt":"2025-09-17T01:50:57","guid":{"rendered":"http:\/\/121.41.116.78\/?p=17"},"modified":"2025-09-19T12:22:52","modified_gmt":"2025-09-19T04:22:52","slug":"%e5%9c%a8mysql%e7%99%bb%e5%bd%95%e4%b8%8d%e8%bf%9b%e5%8e%bb%e7%9a%84%e6%83%85%e5%86%b5%e4%b8%8b%ef%bc%8c%e9%87%8d%e7%bd%ae%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/kayden.top\/?p=17","title":{"rendered":"\u5728MySQL\u767b\u5f55\u4e0d\u8fdb\u53bb\u7684\u60c5\u51b5\u4e0b\uff0c\u91cd\u7f6e\u5bc6\u7801"},"content":{"rendered":"\n<p class=\"wp-block-paragraph\" id=\"u25e81275\">\u4ee5\u4e0b\u662f\u9488\u5bf9 MySQL 8.0 \u7684\u91cd\u7f6e\u5bc6\u7801\u6b65\u9aa4\uff1a<\/p>\n\n\n\n<p class=\"has-small-font-size wp-block-paragraph\">\u4e3b\u8981\u662f\u5229\u7528mysql\u8df3\u8fc7\u6743\u9650\u68c0\u67e5\u65b9\u5f0f\u6765\u8fd0\u884c\uff0c\u6e05\u7a7aroot\u7528\u6237\u7684\u5bc6\u7801\uff1b\u518d\u4f7f\u7528\u7a7a\u5bc6\u7801\u767b\u5f55root\uff0c\u53bbalter\u4e00\u4e2a\u65b0\u5bc6\u7801\uff1b<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"aEqyK\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"l22Mr\"><strong>1. \u505c\u6b62 MySQL \u670d\u52a1<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\uff09\uff1b<\/li>\n\n\n\n<li>\u505c\u6b62 MySQL \u670d\u52a1\uff1a<kbd>cmd<\/kbd>  <kbd>net stop MySQL80<\/kbd><\/li>\n<\/ol>\n\n\n\n<p class=\"wp-block-paragraph\" id=\"u4140a6d0\">\uff08\u6ce8\u610f\uff1a<code>MySQL80<\/code> \u662f MySQL 8.0 \u7684\u9ed8\u8ba4\u670d\u52a1\u540d\u79f0\uff0c\u5982\u679c\u4f60\u7684\u670d\u52a1\u540d\u79f0\u4e0d\u540c\uff0c\u8bf7\u66ff\u6362\u4e3a\u6b63\u786e\u7684\u540d\u79f0\uff09<\/p>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"lx6ST\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"uLWaB\"><strong>2. \u542f\u52a8 MySQL \u5e76\u8df3\u8fc7\u6743\u9650\u68c0\u67e5<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff08\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\uff09;<\/li>\n\n\n\n<li>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u542f\u52a8 MySQL \u5e76\u8df3\u8fc7\u6743\u9650\u68c0\u67e5\uff1a<kbd>cmd<\/kbd>  <kbd>mysqld --skip-grant-tables --shared-memory<\/kbd> <br>\u6b64\u65f6 MySQL \u4f1a\u4ee5\u8df3\u8fc7\u6743\u9650\u9a8c\u8bc1\u7684\u65b9\u5f0f\u8fd0\u884c\uff1b<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"ahrJ5\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"i7uHJ\"><strong>3. \u4ee5 root \u7528\u6237\u767b\u5f55 MySQL<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6253\u5f00\u4e00\u4e2a\u65b0\u7684\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\uff08\u4ee5\u7ba1\u7406\u5458\u8eab\u4efd\u8fd0\u884c\uff09\uff1b<\/li>\n\n\n\n<li>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u767b\u5f55 MySQL\uff08\u65e0\u9700\u5bc6\u7801\uff09\uff1acmd  mysql -u root<\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"tTKot\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"aZoGi\"><strong>4. \u6e05\u7a7a root \u7528\u6237\u7684\u5bc6\u7801<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5728 MySQL \u547d\u4ee4\u884c\u4e2d\uff0c\u5207\u6362\u5230 <code>mysql<\/code> \u6570\u636e\u5e93\uff1asql\u590d\u5236USE mysql\uff1b<\/li>\n\n\n\n<li>\u6e05\u7a7a <code>root<\/code> \u7528\u6237\u7684\u5bc6\u7801\uff1a<kbd>sql<\/kbd>  <kbd>UPDATE user SET authentication_string='' WHERE User='root';<\/kbd><br>\u8fd9\u5c06\u6e05\u7a7a <code>root<\/code> \u7528\u6237\u7684\u5bc6\u7801\uff1b<\/li>\n\n\n\n<li>\u5237\u65b0\u6743\u9650\uff1a<kbd>sql<\/kbd>  <kbd>FLUSH PRIVILEGES;<\/kbd><\/li>\n\n\n\n<li>\u9000\u51fa MySQL\uff1a<kbd>sql<\/kbd>  <kbd>EXIT;<\/kbd><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"TvRCa\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"H58vQ\"><strong>5. \u505c\u6b62 MySQL \u5e76\u91cd\u65b0\u542f\u52a8\u670d\u52a1<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u5728\u8fd0\u884c <code>mysqld --skip-grant-tables<\/code> \u7684\u547d\u4ee4\u63d0\u793a\u7b26\u7a97\u53e3\u4e2d\uff0c\u6309 <code>Ctrl + C<\/code> \u505c\u6b62 MySQL\uff1b<\/li>\n\n\n\n<li>\u91cd\u65b0\u542f\u52a8 MySQL \u670d\u52a1\uff1a<kbd>cmd<\/kbd>  <kbd>net start MySQL80<\/kbd><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"VBHfS\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"wpiCz\"><strong>6. \u4f7f\u7528\u7a7a\u5bc6\u7801\u767b\u5f55\u5e76\u8bbe\u7f6e\u65b0\u5bc6\u7801<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u5f55 MySQL\uff08\u6b64\u65f6\u5bc6\u7801\u4e3a\u7a7a\uff09\uff1a<kbd>cmd<\/kbd>  <kbd>mysql -u root<\/kbd><\/li>\n\n\n\n<li>\u8bbe\u7f6e\u65b0\u5bc6\u7801\uff1a<kbd>sql<\/kbd>  <kbd>ALTER USER 'root'@'localhost' IDENTIFIED BY '\u65b0\u5bc6\u7801';<\/kbd><br>\u4f8b\u5982\uff1a<kbd>sql<\/kbd>  <kbd>ALTER USER 'root'@'localhost' IDENTIFIED BY 'MyNewPassword';<\/kbd><\/li>\n\n\n\n<li>\u5237\u65b0\u6743\u9650\uff1a<kbd>sql<\/kbd>  <kbd>FLUSH PRIVILEGES;<\/kbd><\/li>\n\n\n\n<li>\u9000\u51fa MySQL\uff1a<kbd>sql<\/kbd>  <kbd>EXIT;<\/kbd><\/li>\n<\/ol>\n\n\n\n<hr class=\"wp-block-separator has-alpha-channel-opacity\" id=\"nQByp\"\/>\n\n\n\n<h3 class=\"wp-block-heading\" id=\"CopFQ\"><strong>7. \u4f7f\u7528\u65b0\u5bc6\u7801\u767b\u5f55 MySQL<\/strong><\/h3>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u6253\u5f00\u547d\u4ee4\u63d0\u793a\u7b26\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u5f55 MySQL\uff1a<kbd>cmd<\/kbd>  <kbd>mysql -u root -p<\/kbd><\/li>\n\n\n\n<li>\u8f93\u5165\u4f60\u8bbe\u7f6e\u7684\u65b0\u5bc6\u7801\u5373\u53ef\u767b\u5f55\uff1b<\/li>\n<\/ol>\n","protected":false},"excerpt":{"rendered":"<p>\u4ee5\u4e0b\u662f\u9488\u5bf9 MySQL 8.0 \u7684\u91cd\u7f6e\u5bc6\u7801\u6b65\u9aa4<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"open","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[4],"tags":[],"class_list":["post-17","post","type-post","status-publish","format-standard","hentry","category-databases"],"_links":{"self":[{"href":"https:\/\/kayden.top\/index.php?rest_route=\/wp\/v2\/posts\/17","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/kayden.top\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/kayden.top\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/kayden.top\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/kayden.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=17"}],"version-history":[{"count":26,"href":"https:\/\/kayden.top\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions"}],"predecessor-version":[{"id":132,"href":"https:\/\/kayden.top\/index.php?rest_route=\/wp\/v2\/posts\/17\/revisions\/132"}],"wp:attachment":[{"href":"https:\/\/kayden.top\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=17"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/kayden.top\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=17"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/kayden.top\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=17"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}