{"id":5473,"date":"2024-11-14T11:39:57","date_gmt":"2024-11-14T03:39:57","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5473\/"},"modified":"2024-11-14T11:39:57","modified_gmt":"2024-11-14T03:39:57","slug":"mysql%e6%80%8e%e4%b9%88%e5%8d%b8%e8%bd%bd%e8%bf%9c%e7%a8%8b%e8%ae%bf%e9%97%ae","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5473\/","title":{"rendered":"mysql\u600e\u4e48\u5378\u8f7d\u8fdc\u7a0b\u8bbf\u95ee"},"content":{"rendered":"<blockquote><p>\n  \u4e3a\u4e86\u5378\u8f7d mysql \u8fdc\u7a0b\u8bbf\u95ee\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u505c\u6b62 mysql \u670d\u52a1\u3002\u7f16\u8f91 mysql \u914d\u7f6e\u6587\u4ef6\uff0c\u79fb\u9664\u8fdc\u7a0b\u8bbf\u95ee\u914d\u7f6e\u3002\u91cd\u542f mysql \u670d\u52a1\u3002\u5237\u65b0\u6743\u9650\uff08\u53ef\u9009\uff09\u3002\u5220\u9664 mysql \u8fdc\u7a0b\u8bbf\u95ee\u7528\u6237\uff08\u53ef\u9009\uff09\u3002\u5220\u9664 mysql \u8fdc\u7a0b\u8bbf\u95ee\u4e3b\u673a\uff08\u53ef\u9009\uff09\u3002\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u540e\uff0c\u8fdc\u7a0b\u8fde\u63a5\u5c06\u88ab\u963b\u6b62\uff0c\u53ea\u5141\u8bb8\u6765\u81ea\u672c\u5730\u8ba1\u7b97\u673a\u7684\u8fde\u63a5\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202405\/29\/2024052902572311964.jpg\" class=\"aligncenter\" title=\"mysql\u600e\u4e48\u5378\u8f7d\u8fdc\u7a0b\u8bbf\u95ee\u63d2\u56fe\" alt=\"mysql\u600e\u4e48\u5378\u8f7d\u8fdc\u7a0b\u8bbf\u95ee\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5378\u8f7d MySQL \u8fdc\u7a0b\u8bbf\u95ee<\/strong><\/p>\n<p>\u4e3a\u4e86\u5378\u8f7d MySQL \u8fdc\u7a0b\u8bbf\u95ee\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u505c\u6b62 MySQL \u670d\u52a1\uff1a<\/strong><\/p>\n<pre>sudo service mysql stop<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u7f16\u8f91 MySQL \u914d\u7f6e\u6587\u4ef6\uff1a<\/strong><\/p>\n<pre>sudo nano \/etc\/mysql\/mysql.conf.d\/mysqld.cnf<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u79fb\u9664\u8fdc\u7a0b\u8bbf\u95ee\u914d\u7f6e\uff1a<\/strong><br \/>\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u627e\u5230\u4ee5\u4e0b\u884c\u5e76\u5c06\u5176\u6ce8\u91ca\u6389\u6216\u5220\u9664\uff1a<\/p>\n<pre>bind-address = 0.0.0.0<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u91cd\u542f MySQL \u670d\u52a1\uff1a<\/strong><\/p>\n<pre>sudo service mysql start<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u5237\u65b0\u6743\u9650\uff1a<\/strong><\/p>\n<pre>sudo mysql -u root -p\nmysql&gt; FLUSH PRIVILEGES;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>6. \u5220\u9664 MySQL \u8fdc\u7a0b\u8bbf\u95ee\u7528\u6237\uff08\u53ef\u9009\uff09\uff1a<\/strong><br \/>\u5982\u679c\u4e0d\u518d\u9700\u8981\u8fdc\u7a0b\u8bbf\u95ee\uff0c\u53ef\u4ee5\u5220\u9664\u521b\u5efa\u7684\u8fdc\u7a0b\u8bbf\u95ee\u7528\u6237\uff1a<\/p>\n<pre>mysql&gt; DROP USER 'username'@'hostname';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>7. \u5220\u9664 MySQL \u8fdc\u7a0b\u8bbf\u95ee\u4e3b\u673a\uff08\u53ef\u9009\uff09\uff1a<\/strong><br \/>\u5982\u679c\u4e0d\u518d\u9700\u8981\u5141\u8bb8\u8fdc\u7a0b\u8bbf\u95ee\u7684\u4e3b\u673a\uff0c\u53ef\u4ee5\u5220\u9664\u5b83\u4eec\uff1a<\/p>\n<pre>mysql&gt; DELETE FROM mysql.user WHERE Host LIKE '%hostname%';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u6ce8\u610f\uff1a<\/strong><\/p>\n<ul>\n<li>\u4ee5\u4e0a\u6b65\u9aa4\u9002\u7528\u4e8e Ubuntu \u7cfb\u7edf\u3002\u5728\u5176\u4ed6\u7cfb\u7edf\u4e0a\uff0c\u547d\u4ee4\u548c\u914d\u7f6e\u6587\u4ef6\u8def\u5f84\u53ef\u80fd\u6709\u6240\u4e0d\u540c\u3002<\/li>\n<li>\u786e\u4fdd\u4ee5 root \u7528\u6237\u6216\u62e5\u6709 sudo \u6743\u9650\u7684\u7528\u6237\u8eab\u4efd\u6267\u884c\u8fd9\u4e9b\u6b65\u9aa4\u3002<\/li>\n<li>\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u540e\uff0c\u8fdc\u7a0b\u8fde\u63a5\u5c06\u88ab\u963b\u6b62\u3002\u53ea\u5141\u8bb8\u6765\u81ea\u672c\u5730\u8ba1\u7b97\u673a\u7684\u8fde\u63a5\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u5378\u8f7d\u8fdc\u7a0b\u8bbf\u95ee\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>\u4e3a\u4e86\u5378\u8f7d mysql \u8fdc\u7a0b\u8bbf\u95ee\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a\u505c\u6b62 mysql \u670d\u52a1\u3002\u7f16\u8f91 mysql \u914d\u7f6e\u6587\u4ef6\uff0c\u79fb\u9664\u8fdc\u7a0b\u8bbf\u95ee\u914d\u7f6e\u3002\u91cd\u542f mysql \u670d\u52a1\u3002\u5237\u65b0\u6743\u9650\uff08\u53ef\u9009\uff09\u3002\u5220\u9664 mysql \u8fdc\u7a0b\u8bbf\u95ee\u7528\u6237\uff08\u53ef\u9009\uff09\u3002\u5220\u9664 mysql \u8fdc\u7a0b\u8bbf\u95ee\u4e3b\u673a\uff08\u53ef\u9009\uff09\u3002\u5b8c\u6210\u8fd9\u4e9b\u6b65\u9aa4\u540e\uff0c\u8fdc\u7a0b\u8fde\u63a5\u5c06\u88ab\u963b\u6b62\uff0c\u53ea\u5141\u8bb8\u6765\u81ea\u672c\u5730\u8ba1\u7b97\u673a\u7684\u8fde\u63a5\u3002 \u5982\u4f55\u5378\u8f7d MySQL \u8fdc\u7a0b\u8bbf\u95ee \u4e3a\u4e86\u5378\u8f7d MySQL \u8fdc\u7a0b\u8bbf\u95ee\uff0c\u9700\u8981\u6267\u884c\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u505c\u6b62 MySQL \u670d\u52a1\uff1a sudo service mysql stop \u767b\u5f55\u540e\u590d\u5236 2. \u7f16\u8f91 MySQL \u914d\u7f6e\u6587\u4ef6\uff1a sudo nano \/etc\/mysql\/mysql.conf.d\/mysqld.cnf \u767b\u5f55\u540e\u590d\u5236 3. \u79fb\u9664\u8fdc\u7a0b\u8bbf\u95ee\u914d\u7f6e\uff1a\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff0c\u627e\u5230\u4ee5\u4e0b\u884c\u5e76\u5c06\u5176\u6ce8\u91ca\u6389\u6216\u5220\u9664\uff1a bind-address = 0.0.0.0 \u767b\u5f55\u540e\u590d\u5236 4. \u91cd\u542f MySQL \u670d\u52a1\uff1a sudo service mysql start \u767b\u5f55\u540e\u590d\u5236 5. \u5237\u65b0\u6743\u9650\uff1a sudo mysql [&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-5473","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5473","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=5473"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5473\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5473"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5473"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5473"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}