{"id":6010,"date":"2024-11-14T13:04:41","date_gmt":"2024-11-14T05:04:41","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6010\/"},"modified":"2024-11-14T13:04:41","modified_gmt":"2024-11-14T05:04:41","slug":"mysql%e5%a6%82%e4%bd%95%e8%ae%be%e7%bd%ae%e5%af%86%e7%a0%81","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6010\/","title":{"rendered":"mysql\u5982\u4f55\u8bbe\u7f6e\u5bc6\u7801"},"content":{"rendered":"<p><strong>\u5982\u4f55\u5728  \u4e2d\u8bbe\u7f6e\u5bc6\u7801<\/strong><\/p>\n<p>\u8bbe\u7f6e MySQL \u5bc6\u7801\u662f\u4e00\u4e2a\u5fc5\u8981\u7684\u5b89\u5168\u63aa\u65bd\uff0c\u53ef\u4ee5\u9632\u6b62\u672a\u7ecf\u6388\u6743\u7684\u8bbf\u95ee\u3002\u4ee5\u4e0b\u6b65\u9aa4\u4ecb\u7ecd\u4e86\u5982\u4f55\u8bbe\u7f6e\u5bc6\u7801\uff1a<\/p>\n<p><strong>\u6b65\u9aa4 1\uff1a\u767b\u5f55 MySQL<\/strong><\/p>\n<p>\u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>mysql -u root<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 2\uff1a\u521b\u5efa\u5bc6\u7801<\/strong><\/p>\n<p>\u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u521b\u5efa\u5bc6\u7801\uff1a<\/p>\n<pre>SET PASSWORD FOR 'root'@'localhost' = PASSWORD('\u65b0\u5bc6\u7801');<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5c06 &#8220;\u65b0\u5bc6\u7801&#8221; \u66ff\u6362\u4e3a\u4f60\u5e0c\u671b\u8bbe\u7f6e\u7684\u5bc6\u7801\u3002<\/p>\n<p><strong>\u6b65\u9aa4 3\uff1a\u5237\u65b0\u6743\u9650<\/strong><\/p>\n<p>\u4e3a\u4e86\u4f7f\u65b0\u5bc6\u7801\u751f\u6548\uff0c\u9700\u8981\u5237\u65b0\u6743\u9650\uff1a<\/p>\n<pre>FLUSH PRIVILEGES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6b65\u9aa4 4\uff1a\u9000\u51fa\u5e76\u91cd\u65b0\u8fde\u63a5<\/strong><\/p>\n<p>\u9000\u51fa MySQL\uff0c\u7136\u540e\u4f7f\u7528\u65b0\u5bc6\u7801\u91cd\u65b0\u8fde\u63a5\uff1a<\/p>\n<pre>exit\nmysql -u root -p<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u63d0\u793a\u8f93\u5165\u5bc6\u7801\u65f6\uff0c\u8f93\u5165\u4f60\u5728\u6b65\u9aa4 2 \u4e2d\u8bbe\u7f6e\u7684\u65b0\u5bc6\u7801\u3002<\/p>\n<p><strong>\u4fdd\u62a4\u5bc6\u7801\u7684\u5b89\u5168<\/strong><\/p>\n<ul>\n<li>\u9009\u62e9\u4e00\u4e2a\u5f3a\u5bc6\u7801\uff0c\u5305\u542b\u5927\u5199\u5b57\u6bcd\u3001\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u7b26\u53f7\u3002<\/li>\n<li>\u5b9a\u671f\u66f4\u6539\u5bc6\u7801\u3002<\/li>\n<li>\u907f\u514d\u4f7f\u7528\u5bb9\u6613\u731c\u6d4b\u7684\u5bc6\u7801\uff0c\u4f8b\u5982\u4f60\u7684\u7528\u6237\u540d\u6216\u751f\u65e5\u3002<\/li>\n<li>\u4e0d\u8981\u5c06\u5bc6\u7801\u5b58\u50a8\u5728\u7eaf\u6587\u672c\u6587\u4ef6\u4e2d\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8bbe\u7f6e\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\u5728 \u4e2d\u8bbe\u7f6e\u5bc6\u7801 \u8bbe\u7f6e MySQL \u5bc6\u7801\u662f\u4e00\u4e2a\u5fc5\u8981\u7684\u5b89\u5168\u63aa\u65bd\uff0c\u53ef\u4ee5\u9632\u6b62\u672a\u7ecf\u6388\u6743\u7684\u8bbf\u95ee\u3002\u4ee5\u4e0b\u6b65\u9aa4\u4ecb\u7ecd\u4e86\u5982\u4f55\u8bbe\u7f6e\u5bc6\u7801\uff1a \u6b65\u9aa4 1\uff1a\u767b\u5f55 MySQL \u6253\u5f00\u4e00\u4e2a\u7ec8\u7aef\u6216\u547d\u4ee4\u884c\u7a97\u53e3\uff0c\u952e\u5165\u4ee5\u4e0b\u547d\u4ee4\uff1a mysql -u root \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 2\uff1a\u521b\u5efa\u5bc6\u7801 \u8f93\u5165\u4ee5\u4e0b\u547d\u4ee4\u4ee5\u521b\u5efa\u5bc6\u7801\uff1a SET PASSWORD FOR &#8216;root&#8217;@&#8217;localhost&#8217; = PASSWORD(&#8216;\u65b0\u5bc6\u7801&#8217;); \u767b\u5f55\u540e\u590d\u5236 \u5c06 &#8220;\u65b0\u5bc6\u7801&#8221; \u66ff\u6362\u4e3a\u4f60\u5e0c\u671b\u8bbe\u7f6e\u7684\u5bc6\u7801\u3002 \u6b65\u9aa4 3\uff1a\u5237\u65b0\u6743\u9650 \u4e3a\u4e86\u4f7f\u65b0\u5bc6\u7801\u751f\u6548\uff0c\u9700\u8981\u5237\u65b0\u6743\u9650\uff1a FLUSH PRIVILEGES; \u767b\u5f55\u540e\u590d\u5236 \u6b65\u9aa4 4\uff1a\u9000\u51fa\u5e76\u91cd\u65b0\u8fde\u63a5 \u9000\u51fa MySQL\uff0c\u7136\u540e\u4f7f\u7528\u65b0\u5bc6\u7801\u91cd\u65b0\u8fde\u63a5\uff1a exit mysql -u root -p \u767b\u5f55\u540e\u590d\u5236 \u63d0\u793a\u8f93\u5165\u5bc6\u7801\u65f6\uff0c\u8f93\u5165\u4f60\u5728\u6b65\u9aa4 2 \u4e2d\u8bbe\u7f6e\u7684\u65b0\u5bc6\u7801\u3002 \u4fdd\u62a4\u5bc6\u7801\u7684\u5b89\u5168 \u9009\u62e9\u4e00\u4e2a\u5f3a\u5bc6\u7801\uff0c\u5305\u542b\u5927\u5199\u5b57\u6bcd\u3001\u5c0f\u5199\u5b57\u6bcd\u3001\u6570\u5b57\u548c\u7b26\u53f7\u3002 \u5b9a\u671f\u66f4\u6539\u5bc6\u7801\u3002 \u907f\u514d\u4f7f\u7528\u5bb9\u6613\u731c\u6d4b\u7684\u5bc6\u7801\uff0c\u4f8b\u5982\u4f60\u7684\u7528\u6237\u540d\u6216\u751f\u65e5\u3002 \u4e0d\u8981\u5c06\u5bc6\u7801\u5b58\u50a8\u5728\u7eaf\u6587\u672c\u6587\u4ef6\u4e2d\u3002 \u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8bbe\u7f6e\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6010","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6010","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=6010"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6010\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6010"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6010"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6010"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}