{"id":33,"date":"2024-03-14T20:29:05","date_gmt":"2024-03-14T12:29:05","guid":{"rendered":"http:\/\/101.37.164.116:2233\/?p=33"},"modified":"2025-02-25T10:39:52","modified_gmt":"2025-02-25T02:39:52","slug":"mysql%e4%bf%ae%e6%94%b9%e7%99%bb%e5%bd%95%e5%af%86%e7%a0%81%e7%9a%84%e5%87%a0%e7%a7%8d%e6%96%b9%e6%b3%95","status":"publish","type":"post","link":"https:\/\/www.madbull.site\/?p=33","title":{"rendered":"MySql\u4fee\u6539\u767b\u5f55\u5bc6\u7801\u7684\u51e0\u79cd\u65b9\u6cd5"},"content":{"rendered":"\n<p class=\"has-large-font-size\" style=\"margin-top:0;margin-bottom:0;padding-top:0;padding-bottom:0\"><strong>1\u3001\u7528SET PASSWORD\u547d\u4ee4<\/strong><\/p>\n\n\n\n<p>\u767b\u5f55MySQL\u540e\uff0c\u5728\u547d\u4ee4\u884c\u6267\u884c\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-60cb451d839f694c6f57b81323b02a9c\"><strong>set password for \u7528\u6237\u540d@localhost = password(&#8216;\u65b0\u5bc6\u7801&#8217;);<\/strong><\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-2030b324a1d54005cd50817e8780eb4f\"><strong>FLUSH PRIVILEGES;<\/strong><\/p>\n\n\n\n<p>\u4f8b\u5b50\uff1aset password for root@localhost= password(&#8216;pppppp&#8217;);<\/p>\n\n\n\n<p>\u4e0a\u9762\u4f8b\u5b50\u5c06\u7528\u6237root\u5728\u672c\u5730\uff08localhost\uff09\u767b\u5f55\u7684\u5bc6\u7801\u66f4\u6539\u4e3a\uff1apppppp\u3002\u5982\u679c\u4fee\u6539\u5176\u4ed6\u5730\u5740\u767b\u5f55\u65b9\u5f0f\u7684\u5bc6\u7801\uff0c\u53ef\u4ee5\u5c06localhost\u66f4\u6362\u5176\u4ed6\u767b\u5f55\u5730\u5740\u3002<\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>2 \uff1a\u7528mysqladmin\u5de5\u5177<\/strong><\/p>\n\n\n\n<p>\u5728\u547d\u4ee4\u884c\u6267\u884c\uff1a<\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-4e46c22e35e7494bd118754a9de82944\"><strong>mysqladmin -u\u7528\u6237\u540d -p\u65e7\u5bc6\u7801 password \u65b0\u5bc6\u7801<\/strong><\/p>\n\n\n\n<p>\u4f8b\u5b50\uff1amysqladmin -uroot -poldpwd password pppppp<\/p>\n\n\n\n<p>\u4e0a\u9762\u4f8b\u5b50\u5c06\u7528\u6237root\u6240\u6709\u7684\u767b\u5f55\u5bc6\u7801\u4eceoldpwd\u66f4\u6539\u4e3a\uff1apppppp<\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>3\u3001\u7528UPDATE\u76f4\u63a5\u7f16\u8f91user\u8868<\/strong><\/p>\n\n\n\n<p>\u767b\u5f55MySQL\u540e\uff0c\u5728\u547d\u4ee4\u884c\u6267\u884c\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-c6b0c2f10d612f65f89bf341a1ae2ff3\"><strong>update mysql.user set password=password(\u2018\u65b0\u5bc6\u7801&#8217;) where user=&#8221;\u7528\u6237\u540d&#8221;;<\/strong><\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-2030b324a1d54005cd50817e8780eb4f\"><strong>FLUSH PRIVILEGES;<\/strong><\/p>\n\n\n\n<p>\u4f8b\u5b50\uff1aupdate mysql.user set password=password(&#8220;pppppp&#8221;) where user=&#8221;root&#8221;;<\/p>\n\n\n\n<p>\u4e0a\u9762\u4f8b\u5b50\u5c06\u7528\u6237root\u6240\u6709\u7684\u767b\u5f55\u5bc6\u7801\u66f4\u6539\u4e3a\uff1apppppp<\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>4\u3001\u7528ALTER USER \u6307\u4ee4<\/strong><\/p>\n\n\n\n<p>\u767b\u5f55MySQL\u540e\uff0c\u5728\u547d\u4ee4\u884c\u6267\u884c\u4ee5\u4e0b\u6307\u4ee4\uff1a<\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-bebd5eceddfe99483580d0064001d629\"><strong>ALTER USER &#8216;<strong>\u7528\u6237\u540d<\/strong>&#8216;@&#8217;localhost&#8217; IDENTIFIED WITH mysql_native_password<\/strong> <strong>BY &#8216;<strong>\u65b0\u5bc6\u7801<\/strong>&#8216;;<\/strong><\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-2030b324a1d54005cd50817e8780eb4f\"><strong>FLUSH PRIVILEGES;<\/strong><\/p>\n\n\n\n<p>\u4f8b\u5b50\uff1aALTER USER &#8216;root&#8217;@&#8217;localhost&#8217; IDENTIFIED BY &#8216;pppppp&#8217;;<\/p>\n\n\n\n<p>\u4e0a\u9762\u4f8b\u5b50\u5c06\u7528\u6237root\u6240\u6709\u7684\u767b\u5f55\u5bc6\u7801\u66f4\u6539\u4e3a\uff1apppppp<\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>5\u3001\u8df3\u8fc7\u767b\u5f55\u8ba4\u8bc1\u4fee\u6539\u5bc6\u7801<\/strong><\/p>\n\n\n\n<p>\u5728\u5fd8\u8bb0root\u5bc6\u7801\u7684\u65f6\u5019\u9002\u7528\uff0c\u76f4\u63a5\u4fee\u6539MySql\u7684\u767b\u5f55\u65b9\u5f0f\uff0c\u8df3\u8fc7\u6388\u6743\u8868\u540e\u4fee\u6539\u5bc6\u7801\uff0c\u7136\u540e\u518d\u56de\u590d\u6388\u6743\u9a8c\u8bc1<\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-f4d3ba3e25df03829da94a3d4430a2ff\"><strong>\u7b2c\u4e00\u6b65\uff1a\u5728\u914d\u7f6e\u6587\u4ef6 my.cnf \u91cc\u9762\u6dfb\u52a0\u8bed\u53e5\uff1askip-grant-table\uff1b<\/strong><\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-1b26d1fba783097cbb17e80882c56600\"><strong>\u7b2c\u4e8c\u6b65\uff1a\u91cd\u542fmysql\u670d\u52a1\uff0c\u4f7f\u7528mysql\u547d\u4ee4\u5c31\u53ef\u4ee5\u767b\u9646\u3002mysql -uroot \u5c31\u53ef\u4ee5<\/strong>\uff1b<\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-2b17b967b2c352e1e2543e2c642e91ee\"><strong>\u7b2c\u4e09\u6b65\uff1a\u7528\u4e0a\u8ff0\u7684\u7b2c 1 \u6216\u8005\u7b2c 3 \u4e2a\u65b9\u6cd5\u4fee\u6539\u7528\u6237\u5bc6\u7801\uff1b<\/strong><\/p>\n\n\n\n<p class=\"has-accent-3-color has-text-color has-link-color wp-elements-77e6bcfb67bea0cf948ce69f00615a18\"><strong>\u7b2c\u56db\u6b65\uff1a\u6062\u590dmysql.cnf\u914d\u7f6e\uff0c\u53bb\u6389 skip-grant-table \u914d\u7f6e\u9879\uff0c\u91cd\u542fmysql\u670d\u52a1\u3002<\/strong><\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n\n\n\n<p class=\"has-large-font-size\"><strong>6\u3001\u521a\u5b89\u88c5\u540e\u9996\u6b21\u767b\u5f55<\/strong><\/p>\n\n\n\n<p>\u76f4\u63a5\u4f7f\u7528 mysql -uroot\u767b\u5f55\u540e\uff0c\u4f7f\u7528\u4e0a\u8ff0\u7684\u7b2c 1\u30013\u30014 \u4e2a\u65b9\u6cd5\u4fee\u6539\u7528\u6237\u5bc6\u7801<\/p>\n\n\n\n<p><strong>\u53e6\u5916\u8bf4\u660e\uff0c\u4ee5\u4e0a\u65b9\u6cd5\u5728 mariadb \u4e2d\u4e5f\u9002\u7528<\/strong><\/p>\n\n\n\n<div style=\"height:35px\" aria-hidden=\"true\" class=\"wp-block-spacer\"><\/div>\n","protected":false},"excerpt":{"rendered":"<p>mysql \u6570\u636e\u5e93 password \u8bbe\u7f6e\u5bc6\u7801 \u91cd\u7f6e\u5bc6\u7801 \u627e\u56de\u5bc6\u7801<\/p>\n","protected":false},"author":1,"featured_media":53,"comment_status":"open","ping_status":"open","sticky":false,"template":"single-with-sidebar","format":"standard","meta":{"footnotes":""},"categories":[116,5],"tags":[91,92,93,20,95,94],"class_list":["post-33","post","type-post","status-publish","format-standard","has-post-thumbnail","hentry","category-mysql","category-database","tag-mysql","tag-92","tag-93","tag-20","tag-95","tag-94"],"_links":{"self":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/33","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcomments&post=33"}],"version-history":[{"count":7,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions"}],"predecessor-version":[{"id":2097,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/posts\/33\/revisions\/2097"}],"wp:featuredmedia":[{"embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=\/wp\/v2\/media\/53"}],"wp:attachment":[{"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fmedia&parent=33"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Fcategories&post=33"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.madbull.site\/index.php?rest_route=%2Fwp%2Fv2%2Ftags&post=33"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}