{"id":5501,"date":"2024-11-14T10:24:16","date_gmt":"2024-11-14T02:24:16","guid":{"rendered":"https:\/\/fwq.ai\/blog\/5501\/"},"modified":"2024-11-14T10:24:16","modified_gmt":"2024-11-14T02:24:16","slug":"mysql%e6%80%8e%e4%b9%88%e6%9b%b4%e6%94%b9%e7%ab%af%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/5501\/","title":{"rendered":"mysql\u600e\u4e48\u66f4\u6539\u7aef\u53e3"},"content":{"rendered":"<p><strong>\u5982\u4f55\u66f4\u6539  \u7aef\u53e3<\/strong><\/p>\n<p>\u8981\u66f4\u6539 MySQL \u7aef\u53e3\uff0c\u9700\u8981\u4fee\u6539 MySQL \u914d\u7f6e\u6587\u4ef6\u548c\u9632\u706b\u5899\u8bbe\u7f6e\u3002<\/p>\n<p><strong>\u4fee\u6539 MySQL \u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<ol>\n<li>\u6253\u5f00 MySQL \u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u662f \/etc\/my.cnf \u6216 \/etc\/mysql\/my.cnf\uff09\u3002<\/li>\n<li>\u627e\u5230 [mysqld] \u90e8\u5206\u3002<\/li>\n<li>\u66f4\u6539 port \u9009\u9879\u7684\u503c\u4e3a\u6240\u9700\u7684\u7aef\u53e3\u53f7\uff0c\u4f8b\u5982\uff1a<\/li>\n<\/ol>\n<pre>[mysqld]\nport = 3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u91cd\u65b0\u542f\u52a8 MySQL<\/strong><\/p>\n<p>\u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u540e\uff0c\u9700\u8981\u91cd\u65b0\u542f\u52a8 MySQL \u4ee5\u5e94\u7528\u66f4\u6539\uff1a<\/p>\n<pre>sudo service mysql restart<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u914d\u7f6e\u9632\u706b\u5899<\/strong><\/p>\n<ol>\n<li>\u5982\u679c\u9632\u706b\u5899\u5df2\u542f\u7528\uff0c\u9700\u8981\u5141\u8bb8 MySQL \u4f7f\u7528\u65b0\u7aef\u53e3\u3002<\/li>\n<li>\u5728 Ubuntu\/Debian \u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<pre>sudo ufw allow &lt;new_port&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<ol>\n<li>\u5728 CentOS\/Red Hat \u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/li>\n<\/ol>\n<pre>sudo firewall-cmd --permanent --add-port=&lt;new_port&gt;\/tcp\nsudo firewall-cmd --reload<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u5176\u4ed6\u63d0\u793a<\/strong><\/p>\n<ul>\n<li>\u9009\u62e9\u4e00\u4e2a\u672a\u4f7f\u7528\u7684\u7aef\u53e3\u53f7\u3002<\/li>\n<li>\u786e\u4fdd\u5728\u6240\u6709\u4f7f\u7528 MySQL \u7684\u5e94\u7528\u7a0b\u5e8f\u4e2d\u66f4\u65b0\u7aef\u53e3\u53f7\u3002<\/li>\n<li>\u5982\u679c\u9047\u5230\u95ee\u9898\uff0c\u8bf7\u68c0\u67e5 MySQL \u65e5\u5fd7\u6587\u4ef6\u4ee5\u83b7\u53d6\u66f4\u591a\u4fe1\u606f\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u66f4\u6539\u7aef\u53e3\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 \u7aef\u53e3 \u8981\u66f4\u6539 MySQL \u7aef\u53e3\uff0c\u9700\u8981\u4fee\u6539 MySQL \u914d\u7f6e\u6587\u4ef6\u548c\u9632\u706b\u5899\u8bbe\u7f6e\u3002 \u4fee\u6539 MySQL \u914d\u7f6e\u6587\u4ef6 \u6253\u5f00 MySQL \u914d\u7f6e\u6587\u4ef6\uff08\u901a\u5e38\u662f \/etc\/my.cnf \u6216 \/etc\/mysql\/my.cnf\uff09\u3002 \u627e\u5230 [mysqld] \u90e8\u5206\u3002 \u66f4\u6539 port \u9009\u9879\u7684\u503c\u4e3a\u6240\u9700\u7684\u7aef\u53e3\u53f7\uff0c\u4f8b\u5982\uff1a [mysqld] port = 3306 \u767b\u5f55\u540e\u590d\u5236 \u91cd\u65b0\u542f\u52a8 MySQL \u4fee\u6539\u914d\u7f6e\u6587\u4ef6\u540e\uff0c\u9700\u8981\u91cd\u65b0\u542f\u52a8 MySQL \u4ee5\u5e94\u7528\u66f4\u6539\uff1a sudo service mysql restart \u767b\u5f55\u540e\u590d\u5236 \u914d\u7f6e\u9632\u706b\u5899 \u5982\u679c\u9632\u706b\u5899\u5df2\u542f\u7528\uff0c\u9700\u8981\u5141\u8bb8 MySQL \u4f7f\u7528\u65b0\u7aef\u53e3\u3002 \u5728 Ubuntu\/Debian \u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a sudo ufw allow &lt;new_port&gt; \u767b\u5f55\u540e\u590d\u5236 \u5728 CentOS\/Red Hat \u4e0a\uff0c\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\uff1a sudo firewall-cmd [&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-5501","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5501","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=5501"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/5501\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=5501"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=5501"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=5501"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}