{"id":5453,"date":"2024-11-14T09:48:04","date_gmt":"2024-11-14T01:48:04","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5453\/"},"modified":"2024-11-14T09:48:04","modified_gmt":"2024-11-14T01:48:04","slug":"mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e6%80%8e%e4%b9%88%e6%94%b9%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5453\/","title":{"rendered":"mysql\u6570\u636e\u5e93\u600e\u4e48\u6539\u5bc6\u7801"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u66f4\u6539 mysql \u6570\u636e\u5e93\u5bc6\u7801\uff1f\u767b\u5f55 mysql\uff1amysql -u [\u7528\u6237\u540d] -p\u8f93\u5165\u5f53\u524d\u5bc6\u7801\u66f4\u6539\u5bc6\u7801\uff1aalter user &#8216;[\u7528\u6237\u540d]&#8217;@&#8217;%&#8217; identified by &#8216;[\u65b0\u5bc6\u7801]&#8217;;\u5237\u65b0\u6743\u9650\uff1aflush privileges;\u9000\u51fa\u5e76\u91cd\u65b0\u767b\u5f55\uff1aexit \u540e\u518d mysql -u [\u7528\u6237\u540d] -p \u8f93\u5165\u65b0\u5bc6\u7801\u767b\u5f55\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/28\/2024052814182268225.jpg\" class=\"aligncenter\" title=\"mysql\u6570\u636e\u5e93\u600e\u4e48\u6539\u5bc6\u7801\u63d2\u56fe\" alt=\"mysql\u6570\u636e\u5e93\u600e\u4e48\u6539\u5bc6\u7801\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u66f4\u6539 MySQL \u6570\u636e\u5e93\u5bc6\u7801<\/strong><\/p>\n<p>\u66f4\u6539 MySQL \u6570\u636e\u5e93\u5bc6\u7801\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u8fc7\u7a0b\uff0c\u4ee5\u4e0b\u662f\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u767b\u5f55 MySQL<\/strong><\/p>\n<p>\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u5f55\u5230 MySQL\uff1a<\/p>\n<pre>mysql -u [\u7528\u6237\u540d] -p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c06 [\u7528\u6237\u540d] \u66ff\u6362\u4e3a\u60a8\u81ea\u5df1\u7684 MySQL \u7528\u6237\u540d\u3002<\/p>\n<p><strong>2. \u8f93\u5165\u5f53\u524d\u5bc6\u7801<\/strong><\/p>\n<p>\u7cfb\u7edf\u4f1a\u63d0\u793a\u60a8\u8f93\u5165\u5f53\u524d\u5bc6\u7801\u3002\u8f93\u5165\u5bc6\u7801\u540e\u6309\u56de\u8f66\u952e\u3002<\/p>\n<p><strong>3. \u66f4\u6539\u5bc6\u7801<\/strong><\/p>\n<p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u66f4\u6539\u5bc6\u7801\uff1a<\/p>\n<pre>ALTER USER '[\u7528\u6237\u540d]'@'%' IDENTIFIED BY '[\u65b0\u5bc6\u7801]';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c06 [\u7528\u6237\u540d] \u66ff\u6362\u4e3a\u60a8\u8981\u66f4\u6539\u5bc6\u7801\u7684 MySQL \u7528\u6237\u540d\uff0c\u5c06 [\u65b0\u5bc6\u7801] \u66ff\u6362\u4e3a\u60a8\u7684\u65b0\u5bc6\u7801\u3002<\/p>\n<p><strong>4. \u5237\u65b0\u6743\u9650<\/strong><\/p>\n<p>\u66f4\u6539\u5bc6\u7801\u540e\uff0c\u9700\u8981\u5237\u65b0\u6743\u9650\u624d\u80fd\u4f7f\u66f4\u6539\u751f\u6548\uff1a<\/p>\n<pre>FLUSH PRIVILEGES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u9000\u51fa\u5e76\u91cd\u65b0\u767b\u5f55<\/strong><\/p>\n<p>\u9000\u51fa MySQL \u7136\u540e\u91cd\u65b0\u767b\u5f55\u4ee5\u4f7f\u7528\u65b0\u5bc6\u7801\uff1a<\/p>\n<pre>exit\nmysql -u [\u7528\u6237\u540d] -p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8f93\u5165\u65b0\u5bc6\u7801\u540e\u6309\u56de\u8f66\u952e\u3002<\/p>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u5728\u9009\u62e9\u65b0\u5bc6\u7801\u65f6\uff0c\u8bf7\u4f7f\u7528\u5f3a\u5bc6\u7801\u3002<\/li>\n<li>\u5c06\u5bc6\u7801\u4fdd\u5bc6\u5e76\u4e0d\u8981\u4e0e\u4ed6\u4eba\u5171\u4eab\u3002<\/li>\n<li>\u5b9a\u671f\u66f4\u6539\u5bc6\u7801\u4ee5\u589e\u5f3a\u5b89\u5168\u6027\u3002<\/li>\n<li>\u5728\u6267\u884c\u4e0a\u8ff0\u6b65\u9aa4\u4e4b\u524d\uff0c\u5efa\u8bae\u5907\u4efd\u60a8\u7684\u6570\u636e\u5e93\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6570\u636e\u5e93\u600e\u4e48\u6539\u5bc6\u7801\u7684\u8be6\u7ec6\u5185\u5bb9\uff0c\u66f4\u591a\u8bf7\u5173\u6ce8\u7c73\u4e91\u7f51\u5176\u5b83\u76f8\u5173\u6587\u7ae0\uff01<\/p>\n","protected":false},"excerpt":{"rendered":"<p>\u5982\u4f55\u66f4\u6539 mysql \u6570\u636e\u5e93\u5bc6\u7801\uff1f\u767b\u5f55 mysql\uff1amysql -u [\u7528\u6237\u540d] -p\u8f93\u5165\u5f53\u524d\u5bc6\u7801\u66f4\u6539\u5bc6\u7801\uff1aalter user &#8216;[\u7528\u6237\u540d]&#8217;@&#8217;%&#8217; identified by &#8216;[\u65b0\u5bc6\u7801]&#8217;;\u5237\u65b0\u6743\u9650\uff1aflush privileges;\u9000\u51fa\u5e76\u91cd\u65b0\u767b\u5f55\uff1aexit \u540e\u518d mysql -u [\u7528\u6237\u540d] -p \u8f93\u5165\u65b0\u5bc6\u7801\u767b\u5f55 \u5982\u4f55\u66f4\u6539 MySQL \u6570\u636e\u5e93\u5bc6\u7801 \u66f4\u6539 MySQL \u6570\u636e\u5e93\u5bc6\u7801\u662f\u4e00\u4e2a\u7b80\u5355\u7684\u8fc7\u7a0b\uff0c\u4ee5\u4e0b\u662f\u6b65\u9aa4\uff1a 1. \u767b\u5f55 MySQL \u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u767b\u5f55\u5230 MySQL\uff1a mysql -u [\u7528\u6237\u540d] -p \u767b\u5f55\u540e\u590d\u5236 \u5c06 [\u7528\u6237\u540d] \u66ff\u6362\u4e3a\u60a8\u81ea\u5df1\u7684 MySQL \u7528\u6237\u540d\u3002 2. \u8f93\u5165\u5f53\u524d\u5bc6\u7801 \u7cfb\u7edf\u4f1a\u63d0\u793a\u60a8\u8f93\u5165\u5f53\u524d\u5bc6\u7801\u3002\u8f93\u5165\u5bc6\u7801\u540e\u6309\u56de\u8f66\u952e\u3002 3. \u66f4\u6539\u5bc6\u7801 \u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u66f4\u6539\u5bc6\u7801\uff1a ALTER USER &#8216;[\u7528\u6237\u540d]&#8217;@&#8217;%&#8217; IDENTIFIED BY &#8216;[\u65b0\u5bc6\u7801]&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u5c06 [\u7528\u6237\u540d] [&hellip;]<\/p>\n","protected":false},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-5453","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5453","targetHints":{"allow":["GET"]}}],"collection":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts"}],"about":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/types\/post"}],"author":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/users\/1"}],"replies":[{"embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/comments?post=5453"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5453\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5453"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5453"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5453"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}