{"id":177985,"date":"2024-11-08T17:14:24","date_gmt":"2024-11-08T09:14:24","guid":{"rendered":"https:\/\/server.hk\/cnblog\/177985\/"},"modified":"2024-11-08T17:14:24","modified_gmt":"2024-11-08T09:14:24","slug":"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a41275-sqlstate-hy000-er_server_is_in_secure_auth_mode-%e6%9c%8d%e5%8b%99%e5%99%a8%e6%ad%a3%e5%9c%a8%e9%81%8b%e8%a1%8c-secure-auth","status":"publish","type":"post","link":"https:\/\/server.hk\/cnblog\/177985\/","title":{"rendered":"\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa41275 &#8211; SQLSTATE: HY000 (ER_SERVER_IS_IN_SECURE_AUTH_MODE) \u670d\u52d9\u5668\u6b63\u5728\u904b\u884c&#8211;secure-auth\u6a21\u5f0f\uff0c\u4f46&#8217;%s&#8217;@&#8217;%s&#8217;\u7684\u5bc6\u78bc\u662f\u820a\u683c\u5f0f\uff1b\u8acb\u5c07\u5bc6\u78bc\u66f4\u6539\u70ba\u65b0\u683c\u5f0f"},"content":{"rendered":"<h1 id=\"%e5%a6%82%e4%bd%95%e4%bf%ae%e5%be%a9mysql%e9%8c%af%e8%aa%a41275-sqlstate-hy000-er_server_is_in_secure_auth_mode-VwSETmCEWB\">\u5982\u4f55\u4fee\u5fa9MySQL\u932f\u8aa41275 &#8211; SQLSTATE: HY000 (ER_SERVER_IS_IN_SECURE_AUTH_MODE)<\/h1>\n<p>\u5728\u4f7f\u7528MySQL\u6578\u64da\u5eab\u6642\uff0c\u60a8\u53ef\u80fd\u6703\u9047\u5230\u932f\u8aa4\u4ee3\u78bc1275\uff0c\u8a72\u932f\u8aa4\u4fe1\u606f\u70ba\u201c\u670d\u52d9\u5668\u6b63\u5728\u904b\u884c&#8211;secure-auth\u6a21\u5f0f\uff0c\u4f46&#8217;%s&#8217;@&#8217;%s&#8217;\u7684\u5bc6\u78bc\u662f\u820a\u683c\u5f0f\uff1b\u8acb\u5c07\u5bc6\u78bc\u66f4\u6539\u70ba\u65b0\u683c\u5f0f\u201d\u3002\u9019\u500b\u932f\u8aa4\u901a\u5e38\u51fa\u73fe\u5728MySQL\u4f3a\u670d\u5668\u555f\u7528\u4e86\u5b89\u5168\u8eab\u4efd\u9a57\u8b49\u6a21\u5f0f\uff0c\u4f46\u7528\u6236\u7684\u5bc6\u78bc\u4ecd\u7136\u4f7f\u7528\u820a\u7684\u683c\u5f0f\u3002\u672c\u6587\u5c07\u6df1\u5165\u63a2\u8a0e\u9019\u500b\u554f\u984c\u7684\u539f\u56e0\u53ca\u5176\u89e3\u6c7a\u65b9\u6848\u3002<\/p>\n<h2 id=\"%e9%8c%af%e8%aa%a4%e5%8e%9f%e5%9b%a0-VwSETmCEWB\">\u932f\u8aa4\u539f\u56e0<\/h2>\n<p>MySQL\u7684\u5b89\u5168\u8eab\u4efd\u9a57\u8b49\u6a21\u5f0f\u662f\u70ba\u4e86\u63d0\u9ad8\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\u800c\u5f15\u5165\u7684\u3002\u7576\u4f3a\u670d\u5668\u555f\u7528\u6b64\u6a21\u5f0f\u6642\uff0c\u5b83\u8981\u6c42\u6240\u6709\u7528\u6236\u4f7f\u7528\u66f4\u5b89\u5168\u7684\u5bc6\u78bc\u683c\u5f0f\u3002\u820a\u683c\u5f0f\u7684\u5bc6\u78bc\u901a\u5e38\u662f\u57fa\u65bcMySQL 4.1\u4e4b\u524d\u7684\u7248\u672c\uff0c\u9019\u4e9b\u5bc6\u78bc\u7684\u52a0\u5bc6\u7b97\u6cd5\u76f8\u5c0d\u8f03\u5f31\uff0c\u5bb9\u6613\u53d7\u5230\u653b\u64ca\u3002<\/p>\n<p>\u7576\u60a8\u5617\u8a66\u4f7f\u7528\u820a\u683c\u5f0f\u7684\u5bc6\u78bc\u9023\u63a5\u5230\u555f\u7528\u4e86\u5b89\u5168\u8eab\u4efd\u9a57\u8b49\u7684MySQL\u4f3a\u670d\u5668\u6642\uff0c\u5c31\u6703\u51fa\u73fe\u932f\u8aa41275\u3002\u9019\u610f\u5473\u8457\u60a8\u9700\u8981\u66f4\u65b0\u7528\u6236\u7684\u5bc6\u78bc\uff0c\u4ee5\u7b26\u5408\u65b0\u7684\u5b89\u5168\u6a19\u6e96\u3002<\/p>\n<h2 id=\"%e8%a7%a3%e6%b1%ba%e6%96%b9%e6%a1%88-VwSETmCEWB\">\u89e3\u6c7a\u65b9\u6848<\/h2>\n<p>\u8981\u4fee\u5fa9\u6b64\u932f\u8aa4\uff0c\u60a8\u9700\u8981\u5c07\u7528\u6236\u7684\u5bc6\u78bc\u66f4\u65b0\u70ba\u65b0\u683c\u5f0f\u3002\u4ee5\u4e0b\u662f\u5177\u9ad4\u6b65\u9a5f\uff1a<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f1%ef%bc%9a%e7%99%bb%e9%8c%84%e5%88%b0mysql%e4%bc%ba%e6%9c%8d%e5%99%a8-VwSETmCEWB\">\u6b65\u9a5f1\uff1a\u767b\u9304\u5230MySQL\u4f3a\u670d\u5668<\/h3>\n<pre><code>mysql -u root -p<\/code><\/pre>\n<p>\u4f7f\u7528\u5177\u6709\u8db3\u5920\u6b0a\u9650\u7684\u7528\u6236\uff08\u901a\u5e38\u662froot\u7528\u6236\uff09\u767b\u9304\u5230MySQL\u4f3a\u670d\u5668\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f2%ef%bc%9a%e6%9b%b4%e6%96%b0%e7%94%a8%e6%88%b6%e5%af%86%e7%a2%bc-VwSETmCEWB\">\u6b65\u9a5f2\uff1a\u66f4\u65b0\u7528\u6236\u5bc6\u78bc<\/h3>\n<p>\u4f7f\u7528\u4ee5\u4e0bSQL\u547d\u4ee4\u4f86\u66f4\u65b0\u7528\u6236\u7684\u5bc6\u78bc\uff1a<\/p>\n<pre><code>ALTER USER 'username'@'host' IDENTIFIED WITH mysql_native_password BY 'new_password';<\/code><\/pre>\n<p>\u5728\u9019\u88e1\uff0c\u8acb\u5c07 <code>username<\/code> \u66ff\u63db\u70ba\u60a8\u7684\u7528\u6236\u540d\uff0c<code>host<\/code> \u66ff\u63db\u70ba\u7528\u6236\u7684\u4e3b\u6a5f\u5730\u5740\uff08\u4f8b\u5982\uff0clocalhost\uff09\uff0c\u4e26\u5c07 <code>new_password<\/code> \u66ff\u63db\u70ba\u60a8\u5e0c\u671b\u8a2d\u7f6e\u7684\u65b0\u5bc6\u78bc\u3002<\/p>\n<h3 id=\"%e6%ad%a5%e9%a9%9f3%ef%bc%9a%e5%88%b7%e6%96%b0%e6%ac%8a%e9%99%90-VwSETmCEWB\">\u6b65\u9a5f3\uff1a\u5237\u65b0\u6b0a\u9650<\/h3>\n<p>\u5728\u66f4\u65b0\u5bc6\u78bc\u5f8c\uff0c\u60a8\u9700\u8981\u5237\u65b0\u6b0a\u9650\u4ee5\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre><code>FLUSH PRIVILEGES;<\/code><\/pre>\n<h3 id=\"%e6%ad%a5%e9%a9%9f4%ef%bc%9a%e6%b8%ac%e8%a9%a6%e9%80%a3%e6%8e%a5-VwSETmCEWB\">\u6b65\u9a5f4\uff1a\u6e2c\u8a66\u9023\u63a5<\/h3>\n<p>\u6700\u5f8c\uff0c\u4f7f\u7528\u65b0\u5bc6\u78bc\u91cd\u65b0\u9023\u63a5\u5230MySQL\u4f3a\u670d\u5668\uff0c\u4ee5\u78ba\u4fdd\u554f\u984c\u5df2\u7d93\u89e3\u6c7a\uff1a<\/p>\n<pre><code>mysql -u username -p<\/code><\/pre>\n<p>\u8f38\u5165\u65b0\u5bc6\u78bc\u5f8c\uff0c\u60a8\u61c9\u8a72\u80fd\u5920\u6210\u529f\u9023\u63a5\u5230\u6578\u64da\u5eab\u3002<\/p>\n<h2 id=\"%e9%a0%90%e9%98%b2%e6%8e%aa%e6%96%bd-VwSETmCEWB\">\u9810\u9632\u63aa\u65bd<\/h2>\n<p>\u70ba\u4e86\u907f\u514d\u5c07\u4f86\u518d\u6b21\u9047\u5230\u6b64\u554f\u984c\uff0c\u5efa\u8b70\u60a8\u5b9a\u671f\u6aa2\u67e5\u548c\u66f4\u65b0\u6578\u64da\u5eab\u7528\u6236\u7684\u5bc6\u78bc\uff0c\u4e26\u78ba\u4fdd\u6240\u6709\u7528\u6236\u90fd\u4f7f\u7528\u5b89\u5168\u7684\u5bc6\u78bc\u683c\u5f0f\u3002\u6b64\u5916\uff0c\u60a8\u9084\u53ef\u4ee5\u8003\u616e\u7981\u7528\u820a\u7684\u8eab\u4efd\u9a57\u8b49\u63d2\u4ef6\uff0c\u4ee5\u5f37\u5236\u6240\u6709\u7528\u6236\u4f7f\u7528\u65b0\u7684\u5b89\u5168\u6a19\u6e96\u3002<\/p>\n<h2 id=\"%e7%b8%bd%e7%b5%90-VwSETmCEWB\">\u7e3d\u7d50<\/h2>\n<p>MySQL\u932f\u8aa41275\u662f\u7531\u65bc\u4f3a\u670d\u5668\u555f\u7528\u4e86\u5b89\u5168\u8eab\u4efd\u9a57\u8b49\u6a21\u5f0f\uff0c\u800c\u7528\u6236\u7684\u5bc6\u78bc\u4ecd\u7136\u4f7f\u7528\u820a\u683c\u5f0f\u6240\u5f15\u8d77\u7684\u3002\u901a\u904e\u66f4\u65b0\u7528\u6236\u7684\u5bc6\u78bc\u4e26\u4f7f\u7528\u65b0\u7684\u52a0\u5bc6\u7b97\u6cd5\uff0c\u60a8\u53ef\u4ee5\u8f15\u9b06\u89e3\u6c7a\u6b64\u554f\u984c\u3002\u4fdd\u6301\u6578\u64da\u5eab\u7684\u5b89\u5168\u6027\u662f\u81f3\u95dc\u91cd\u8981\u7684\uff0c\u5b9a\u671f\u6aa2\u67e5\u548c\u66f4\u65b0\u7528\u6236\u7684\u5bc6\u78bc\u5c07\u6709\u52a9\u65bc\u9632\u6b62\u672a\u4f86\u7684\u5b89\u5168\u554f\u984c\u3002<\/p>\n<p>\u5982\u679c\u60a8\u6b63\u5728\u5c0b\u627e\u53ef\u9760\u7684 <a href=\"https:\/\/server.hk\">\u9999\u6e2fVPS<\/a> \u89e3\u6c7a\u65b9\u6848\uff0cServer.HK \u63d0\u4f9b\u591a\u7a2e\u9078\u64c7\uff0c\u6eff\u8db3\u4e0d\u540c\u7528\u6236\u7684\u9700\u6c42\u3002\u7121\u8ad6\u662f\u500b\u4eba\u9805\u76ee\u9084\u662f\u4f01\u696d\u61c9\u7528\uff0c\u6211\u5011\u7684 <a href=\"https:\/\/server.hk\">\u4f3a\u670d\u5668<\/a> \u90fd\u80fd\u70ba\u60a8\u63d0\u4f9b\u7a69\u5b9a\u7684\u652f\u6301\u3002<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u4fee\u5fa9MySQL\u932f\u8aa41275\u7684\u65b9\u6cd5\uff1a\u66f4\u65b0\u820a\u683c\u5f0f\u5bc6\u78bc\u4ee5\u7b26\u5408secure-auth\u6a21\u5f0f\u8981\u6c42\uff0c\u78ba\u4fdd\u6578\u64da\u5eab\u5b89\u5168\u6027\u3002<\/p>\n","protected":false},"author":0,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[101],"tags":[],"class_list":["post-177985","post","type-post","status-publish","format-standard","hentry","category-database"],"_links":{"self":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177985","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/types\/post"}],"replies":[{"embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/comments?post=177985"}],"version-history":[{"count":1,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177985\/revisions"}],"predecessor-version":[{"id":177986,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/posts\/177985\/revisions\/177986"}],"wp:attachment":[{"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/media?parent=177985"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/categories?post=177985"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/server.hk\/cnblog\/wp-json\/wp\/v2\/tags?post=177985"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}