{"id":16464,"date":"2024-12-15T10:42:25","date_gmt":"2024-12-15T02:42:25","guid":{"rendered":"https:\/\/www.orczhou.com\/?p=16464"},"modified":"2024-12-15T10:42:25","modified_gmt":"2024-12-15T02:42:25","slug":"using-mysql-8-0-dual-password-to-update-mysql-password","status":"publish","type":"post","link":"https:\/\/www.orczhou.com\/index.php\/2024\/12\/using-mysql-8-0-dual-password-to-update-mysql-password\/","title":{"rendered":"\u4f7f\u7528 MySQL 8.0 \u53cc\u5bc6\u7801\u529f\u80fd\u5b9e\u73b0\u65e0\u4e2d\u65ad\u7684\u5bc6\u7801\u66f4\u6362"},"content":{"rendered":"\n<p>\u968f\u7740\u4f01\u4e1a\u89c4\u6a21\u589e\u957f\uff0c\u6216\u8005\uff0c\u4f01\u4e1a\u539f\u672c\u5c31\u5728\u76d1\u7ba1\u975e\u5e38\u4e25\u683c\u7684\u884c\u4e1a\u6216\u73af\u5883\uff0c\u6240\u9762\u4e34\u5408\u89c4\u8981\u6c42\u4e5f\u4f1a\u9010\u6b65\u589e\u591a\uff0c\u5bc6\u7801\u7684\u5b9a\u671f\u8f6e\u6362\u901a\u5e38\u4e5f\u662f\u4f17\u591a\u8981\u6c42\u4e2d\u7684\u4e00\u4e2a\u57fa\u7840\u9879\u3002MySQL 8.0 \u63d0\u4f9b\u7684\u201c\u53cc\u5bc6\u7801\u201d\u7ba1\u7406\u673a\u5236\uff0c\u53ef\u4ee5\u8ba9\u5927\u89c4\u6a21\u6570\u636e\u5e93\u5bc6\u7801\u8f6e\u6362\u53d8\u5f97\u66f4\u5e73\u6ed1\uff0c\u800c\u65e0\u9700\u4efb\u4f55\u7684\u505c\u673a\u65f6\u95f4\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">100\u53f0MySQL\u30011000\u53f0\u5e94\u7528\u670d\u52a1<\/h4>\n\n\n\n<p>\u8003\u8651\u8fd9\u6837\u7684\u573a\u666f\uff0c\u4f60\u662f\u4e00\u4e2a DBA \uff0c\u751f\u4ea7\u73af\u5883\u6709 100 \u53f0 MySQL \u5b9e\u4f8b\uff0c\u8fd0\u884c\u5728\u8fd9\u4e9b\u6570\u636e\u5e93\u4e0a\u7ea6\u6709 1000 \u53f0\u5e94\u7528\u670d\u52a1\u5668\u3002\u5982\u679c\u9700\u8981\u5bf9\uff0c\u8fd9\u4e9b MySQL \u7684\u5e94\u7528\u8d26\u53f7\u5bc6\u7801\u7edf\u4e00\u505a\u4e00\u6b21\u66f4\u65b0\uff0c\u5982\u4f55\u5b9e\u73b0\u4e0d\u505c\u673a\u7684\u8fc1\u79fb\u3002<\/p>\n\n\n\n<p>\u5728 MySQL \u4e4b\u524d\uff088.0.14\u7248\u672c\u4e4b\u524d\uff09\u7684\u5355\u5bc6\u7801\u673a\u5236\u4e0b\uff0c\u66f4\u6362\u5bc6\u7801\u901a\u5e38\u4f1a\u9047\u5230\u4ee5\u4e0b\u95ee\u9898\uff1a\u65e0\u8bba\u662f\u5148\u66f4\u65b0\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u7684\u5bc6\u7801\uff0c\u8fd8\u662f\u65b0\u8c03\u6574\u5e94\u7528\u670d\u52a1\u5668\u4e0a\u7684\u5bc6\u7801\uff0c\u8fd9\u4e2a\u5148\u540e\u987a\u5e8f\u90fd\u4f1a\u5e26\u6765\u4e00\u5b9a\u7684\u670d\u52a1\u4e0d\u53ef\u7528\u65f6\u95f4\u3002\u901a\u5e38\uff0c\u4e3a\u4e86\u964d\u4f4e\u8fd9\u4e2a\u670d\u52a1\u4e0d\u53ef\u7528\u65f6\u95f4\uff0c\u5e94\u7528\u53d8\u66f4\u4eba\u5458\u548c DBA \u5219\u9700\u8981\u975e\u5e38\u5bc6\u5207\u7684\u914d\u5408\u3002<\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u53cc\u5bc6\u7801\u673a\u5236\uff08dual password\uff09<\/h4>\n\n\n\n<p>\u4ece MySQL 8.0.14 \u8d77\uff0c\u5f00\u59cb\u652f\u6301\u4e86\u53cc\u5bc6\u7801\u7b56\u7565\u3002\u5728\u5bc6\u7801\u66f4\u6362\u65f6\uff0c\u53ef\u4ee5\u4fdd\u7559\u65e7\u5bc6\u7801\u4f9d\u65e7\u53ef\u7528\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"margin-bottom:var(--wp--preset--spacing--x-small)\"><code lang=\"sql\" class=\"language-sql\">ALTER USER 'appuser1'@'host1.example.com'\n  IDENTIFIED BY 'password_b'\n  RETAIN CURRENT PASSWORD;<\/code><\/pre>\n\n\n\n<p>\u5728\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u53ef\u4ee5\u5220\u9664\u65e7\u5bc6\u7801\uff1a<\/p>\n\n\n\n<pre class=\"wp-block-code\" style=\"margin-bottom:var(--wp--preset--spacing--x-small)\"><code lang=\"sql\" class=\"language-sql\">ALTER USER 'appuser1'@'host1.example.com'\n  DISCARD OLD PASSWORD;<\/code><\/pre>\n\n\n\n<h4 class=\"wp-block-heading\">\u6784\u5efa\u6279\u91cf\u5bc6\u7801\u8f6e\u6362\u6d41\u7a0b<\/h4>\n\n\n\n<p>\u6709\u4e86\u8be5\u529f\u80fd\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0a\u8ff0\u7684\u547d\u4ee4\uff0c\u66f4\u52a0\u5e73\u6ed1\u7684\u5b9e\u73b0\u5927\u89c4\u6a21\u6570\u636e\u5e93\u573a\u666f\u4e0b\u7684\u5bc6\u7801\u66f4\u6362\u3002<\/p>\n\n\n\n<ol class=\"wp-block-list\">\n<li>\u7ed9\u53d8\u66f4\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u8d26\u53f7\u7684\u5bc6\u7801\uff0c\u540c\u65f6\u5c06\u539f\u5bc6\u7801\u4f5c\u4e3a\u5907\u7528\u5bc6\u7801\u4fdd\u7559\uff08\u4f7f\u7528\u201c<code>RETAIN CURRENT PASSWORD<\/code>\u201d\uff09<\/li>\n\n\n\n<li>\u53d8\u66f4\u5e94\u7528\u670d\u52a1\u5668\u4e0a\u7684\u8bbf\u95ee\u6570\u636e\u5e93\u7684\u5bc6\u7801<\/li>\n\n\n\n<li>\u68c0\u67e5\u5e76\u89c2\u5bdf\u4e00\u6bb5\u65f6\u95f4\uff0c\u5220\u9664\u6570\u636e\u5e93\u4e2d\u7684\u539f\u5bc6\u7801\uff08\u4f7f\u7528\u201c<code>DISCARD OLD PASSWORD<\/code> \u201d\uff09<\/li>\n<\/ol>\n\n\n\n<p>\u8fd9\u662f\u4e00\u4e2a\u7b80\u5316\u7684\u8fc7\u7a0b\uff0c\u5b9e\u9645\u7684\u64cd\u4f5c\u8fd8\u9700\u8981\u8003\u8651\uff1a<\/p>\n\n\n\n<ul class=\"wp-block-list\">\n<li>\u4e25\u683c\u9075\u5faa\u4f01\u4e1a\u5185\u90e8\u7684\u53d8\u66f4\u89c4\u8303<\/li>\n\n\n\n<li>\u7070\u5ea6\u7684\u8fdb\u884c\u53d1\u5e03\uff0c\u800c\u4e0d\u662f\u4e00\u6b21\u6027\u64cd\u4f5c\u6240\u6709\u7684\u5b9e\u4f8b\/\u670d\u52a1\u5668<\/li>\n\n\n\n<li>\u505a\u597d\u68c0\u67e5\uff0c\u9700\u8981\u786e\u4fdd\u8bf8\u5982\u5bc6\u7801\u5df2\u7ecf\u53d8\u66f4\u5b8c\u6210\u3001\u5e94\u7528\u670d\u52a1\u5668\u5bc6\u7801\u5747\u5df2\u7ecf\u66f4\u65b0<\/li>\n\n\n\n<li>\u505a\u597d\u56de\u6eda\u65b9\u6848\uff0c\u907f\u514d\u8fc7\u7a0b\u4e2d\u64cd\u4f5c\u5931\u8bef\u5bfc\u81f4\u7684\u95ee\u9898<\/li>\n\n\n\n<li>\u5728\u4e1a\u52a1\u4f4e\u5cf0\u65f6\u95f4\u8fdb\u884c\u64cd\u4f5c<\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<h4 class=\"wp-block-heading\">\u53c2\u8003\u9605\u8bfb<\/h4>\n\n\n\n<ul class=\"wp-block-list is-style-no-disc\">\n<li>[1] <a href=\"https:\/\/dev.mysql.com\/doc\/refman\/8.0\/en\/password-management.html#dual-passwords\" target=\"_blank\" rel=\"noreferrer noopener\">Dual Password Support<\/a><\/li>\n\n\n\n<li>[2] <a href=\"https:\/\/www.percona.com\/blog\/mysql-dual-passwords-how-to-manage-them-programmatically\/\">MySQL Dual Passwords \u2013 How To Manage Them Programmatically<\/a> <\/li>\n<\/ul>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n\n\n\n<p><\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u968f\u7740\u4f01\u4e1a\u89c4\u6a21\u589e\u957f\uff0c\u6216\u8005\uff0c\u4f01\u4e1a\u539f\u672c\u5c31\u5728\u76d1\u7ba1\u975e\u5e38\u4e25\u683c\u7684\u884c\u4e1a\u6216\u73af\u5883\uff0c\u6240\u9762\u4e34\u5408\u89c4\u8981\u6c42\u4e5f\u4f1a\u9010\u6b65\u589e\u591a\uff0c\u5bc6\u7801\u7684\u5b9a\u671f\u8f6e\u6362\u901a\u5e38\u4e5f\u662f\u4f17\u591a\u8981\u6c42\u4e2d\u7684\u4e00\u4e2a\u57fa\u7840\u9879\u3002MySQL 8.0 \u63d0\u4f9b\u7684\u201c\u53cc\u5bc6\u7801\u201d\u7ba1\u7406\u673a\u5236\uff0c\u53ef\u4ee5\u8ba9\u5927\u89c4\u6a21\u6570\u636e\u5e93\u5bc6\u7801\u8f6e\u6362\u53d8\u5f97\u66f4\u5e73\u6ed1\uff0c\u800c\u65e0\u9700\u4efb\u4f55\u7684\u505c\u673a\u65f6\u95f4\u3002 100\u53f0MySQL\u30011000\u53f0\u5e94\u7528\u670d\u52a1 \u8003\u8651\u8fd9\u6837\u7684\u573a\u666f\uff0c\u4f60\u662f\u4e00\u4e2a DBA \uff0c\u751f\u4ea7\u73af\u5883\u6709 100 \u53f0 MySQL \u5b9e\u4f8b\uff0c\u8fd0\u884c\u5728\u8fd9\u4e9b\u6570\u636e\u5e93\u4e0a\u7ea6\u6709 1000 \u53f0\u5e94\u7528\u670d\u52a1\u5668\u3002\u5982\u679c\u9700\u8981\u5bf9\uff0c\u8fd9\u4e9b MySQL \u7684\u5e94\u7528\u8d26\u53f7\u5bc6\u7801\u7edf\u4e00\u505a\u4e00\u6b21\u66f4\u65b0\uff0c\u5982\u4f55\u5b9e\u73b0\u4e0d\u505c\u673a\u7684\u8fc1\u79fb\u3002 \u5728 MySQL \u4e4b\u524d\uff088.0.14\u7248\u672c\u4e4b\u524d\uff09\u7684\u5355\u5bc6\u7801\u673a\u5236\u4e0b\uff0c\u66f4\u6362\u5bc6\u7801\u901a\u5e38\u4f1a\u9047\u5230\u4ee5\u4e0b\u95ee\u9898\uff1a\u65e0\u8bba\u662f\u5148\u66f4\u65b0\u6570\u636e\u5e93\u670d\u52a1\u5668\u4e0a\u7684\u5bc6\u7801\uff0c\u8fd8\u662f\u65b0\u8c03\u6574\u5e94\u7528\u670d\u52a1\u5668\u4e0a\u7684\u5bc6\u7801\uff0c\u8fd9\u4e2a\u5148\u540e\u987a\u5e8f\u90fd\u4f1a\u5e26\u6765\u4e00\u5b9a\u7684\u670d\u52a1\u4e0d\u53ef\u7528\u65f6\u95f4\u3002\u901a\u5e38\uff0c\u4e3a\u4e86\u964d\u4f4e\u8fd9\u4e2a\u670d\u52a1\u4e0d\u53ef\u7528\u65f6\u95f4\uff0c\u5e94\u7528\u53d8\u66f4\u4eba\u5458\u548c DBA \u5219\u9700\u8981\u975e\u5e38\u5bc6\u5207\u7684\u914d\u5408\u3002 \u53cc\u5bc6\u7801\u673a\u5236\uff08dual password\uff09 \u4ece MySQL 8.0.14 \u8d77\uff0c\u5f00\u59cb\u652f\u6301\u4e86\u53cc\u5bc6\u7801\u7b56\u7565\u3002\u5728\u5bc6\u7801\u66f4\u6362\u65f6\uff0c\u53ef\u4ee5\u4fdd\u7559\u65e7\u5bc6\u7801\u4f9d\u65e7\u53ef\u7528\uff1a \u5728\u4e00\u6bb5\u65f6\u95f4\u540e\uff0c\u53ef\u4ee5\u5220\u9664\u65e7\u5bc6\u7801\uff1a \u6784\u5efa\u6279\u91cf\u5bc6\u7801\u8f6e\u6362\u6d41\u7a0b \u6709\u4e86\u8be5\u529f\u80fd\uff0c\u5c31\u53ef\u4ee5\u4f7f\u7528\u4e0a\u8ff0\u7684\u547d\u4ee4\uff0c\u66f4\u52a0\u5e73\u6ed1\u7684\u5b9e\u73b0\u5927\u89c4\u6a21\u6570\u636e\u5e93\u573a\u666f\u4e0b\u7684\u5bc6\u7801\u66f4\u6362\u3002 \u8fd9\u662f\u4e00\u4e2a\u7b80\u5316\u7684\u8fc7\u7a0b\uff0c\u5b9e\u9645\u7684\u64cd\u4f5c\u8fd8\u9700\u8981\u8003\u8651\uff1a \u53c2\u8003\u9605\u8bfb<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"open","ping_status":"closed","sticky":false,"template":"","format":"standard","meta":{"_eb_attr":"","inline_featured_image":false,"_tocer_settings":[],"footnotes":""},"categories":[6],"tags":[],"class_list":["post-16464","post","type-post","status-publish","format-standard","hentry","category-mysql"],"_links":{"self":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/16464","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/comments?post=16464"}],"version-history":[{"count":12,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/16464\/revisions"}],"predecessor-version":[{"id":16476,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/posts\/16464\/revisions\/16476"}],"wp:attachment":[{"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/media?parent=16464"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/categories?post=16464"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/www.orczhou.com\/index.php\/wp-json\/wp\/v2\/tags?post=16464"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}