{"id":6164,"date":"2024-11-14T12:46:27","date_gmt":"2024-11-14T04:46:27","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6164\/"},"modified":"2024-11-14T12:46:27","modified_gmt":"2024-11-14T04:46:27","slug":"mysql%e5%a6%82%e4%bd%95%e8%bf%9c%e7%a8%8b%e8%bf%9e%e6%8e%a5","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6164\/","title":{"rendered":"mysql\u5982\u4f55\u8fdc\u7a0b\u8fde\u63a5"},"content":{"rendered":"<blockquote><p>\n  \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdc\u7a0b\u8fde\u63a5 mysql \u6570\u636e\u5e93\uff1a\u83b7\u53d6 mysql \u670d\u52a1\u76d1\u542c\u7aef\u53e3\uff1b\u914d\u7f6e\u9632\u706b\u5899\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\uff1b\u4f7f\u7528 mysql \u5ba2\u6237\u7aef\u5de5\u5177\u5728\u5ba2\u6237\u7aef\u7cfb\u7edf\u4e0a\u8fde\u63a5\uff0c\u8f93\u5165\u6570\u636e\u5e93\u5bc6\u7801\u5373\u53ef\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/14\/2024061403482430183.jpg\" class=\"aligncenter\" title=\"mysql\u5982\u4f55\u8fdc\u7a0b\u8fde\u63a5\u63d2\u56fe\" alt=\"mysql\u5982\u4f55\u8fdc\u7a0b\u8fde\u63a5\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u8fdc\u7a0b\u8fde\u63a5 MySQL \u6570\u636e\u5e93<\/strong><\/p>\n<p><strong>\u524d\u63d0\u6761\u4ef6<\/strong><\/p>\n<ul>\n<li>\u5df2\u5b89\u88c5\u5e76\u914d\u7f6e MySQL \u670d\u52a1\u5668<\/li>\n<li>\u5df2\u914d\u7f6e\u6570\u636e\u5e93\u7528\u6237\u5e76\u6388\u4e88\u5176\u8fdc\u7a0b\u8bbf\u95ee\u6743\u9650<\/li>\n<\/ul>\n<p><strong>\u6b65\u9aa4<\/strong><\/p>\n<ol>\n<li><strong>\u83b7\u53d6 MySQL \u670d\u52a1\u7684\u76d1\u542c\u7aef\u53e3<\/strong><\/li>\n<\/ol>\n<ul>\n<li>\n<p>\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a<\/p>\n<pre>netstat -anp | grep mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\u627e\u5230\u7aef\u53e3\u53f7\uff0c\u901a\u5e38\u4e3a <strong>3306<\/strong>\u3002<\/li>\n<\/ul>\n<ol>\n<li><strong>\u914d\u7f6e\u9632\u706b\u5899<\/strong><\/li>\n<\/ol>\n<ul>\n<li>\n<p>\u5728\u670d\u52a1\u5668\u4e0a\uff0c\u6253\u5f00\u9632\u706b\u5899\u7aef\u53e3\uff0c\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\uff1a<\/p>\n<pre>sudo ufw allow &lt;\u7aef\u53e3\u53f7&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u4f8b\u5982\uff1a<\/p>\n<pre>sudo ufw allow 3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<ol>\n<li><strong>\u5728\u5ba2\u6237\u7aef\u7cfb\u7edf\u4e0a\u8fde\u63a5<\/strong><\/li>\n<\/ol>\n<ul>\n<li>\n<p>\u5728\u5ba2\u6237\u7aef\u7cfb\u7edf\u4e0a\uff0c\u4f7f\u7528 MySQL \u5ba2\u6237\u7aef\u5de5\u5177\uff08\u5982 \uff09\u8fdb\u884c\u8fde\u63a5\uff1a<\/p>\n<pre>mysql -u &lt;\u7528\u6237\u540d&gt; -p -h &lt;\u670d\u52a1\u5668 IP \u5730\u5740&gt; -P &lt;\u7aef\u53e3\u53f7&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<li>\u8f93\u5165\u6570\u636e\u5e93\u5bc6\u7801\u3002<\/li>\n<\/ul>\n<p><strong>\u793a\u4f8b<\/strong><\/p>\n<pre>mysql -u root -p -h 192.168.1.100 -P 3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u63d0\u793a<\/strong><\/p>\n<ul>\n<li>\u66ff\u6362 \u4e3a\u5177\u6709\u8fdc\u7a0b\u8bbf\u95ee\u6743\u9650\u7684\u6570\u636e\u5e93\u7528\u6237\u3002<\/li>\n<li>\u66ff\u6362 \u4e3a MySQL \u670d\u52a1\u5668\u7684 IP \u5730\u5740\u6216\u4e3b\u673a\u540d\u3002<\/li>\n<li>\u66ff\u6362 \u4e3a MySQL \u670d\u52a1\u76d1\u542c\u7684\u7aef\u53e3\u53f7\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u8fdc\u7a0b\u8fde\u63a5\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>\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u8fdc\u7a0b\u8fde\u63a5 mysql \u6570\u636e\u5e93\uff1a\u83b7\u53d6 mysql \u670d\u52a1\u76d1\u542c\u7aef\u53e3\uff1b\u914d\u7f6e\u9632\u706b\u5899\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\uff1b\u4f7f\u7528 mysql \u5ba2\u6237\u7aef\u5de5\u5177\u5728\u5ba2\u6237\u7aef\u7cfb\u7edf\u4e0a\u8fde\u63a5\uff0c\u8f93\u5165\u6570\u636e\u5e93\u5bc6\u7801\u5373\u53ef\u3002 \u5982\u4f55\u8fdc\u7a0b\u8fde\u63a5 MySQL \u6570\u636e\u5e93 \u524d\u63d0\u6761\u4ef6 \u5df2\u5b89\u88c5\u5e76\u914d\u7f6e MySQL \u670d\u52a1\u5668 \u5df2\u914d\u7f6e\u6570\u636e\u5e93\u7528\u6237\u5e76\u6388\u4e88\u5176\u8fdc\u7a0b\u8bbf\u95ee\u6743\u9650 \u6b65\u9aa4 \u83b7\u53d6 MySQL \u670d\u52a1\u7684\u76d1\u542c\u7aef\u53e3 \u5728\u670d\u52a1\u5668\u4e0a\uff0c\u8fd0\u884c\u4ee5\u4e0b\u547d\u4ee4\uff1a netstat -anp | grep mysql \u767b\u5f55\u540e\u590d\u5236 \u627e\u5230\u7aef\u53e3\u53f7\uff0c\u901a\u5e38\u4e3a 3306\u3002 \u914d\u7f6e\u9632\u706b\u5899 \u5728\u670d\u52a1\u5668\u4e0a\uff0c\u6253\u5f00\u9632\u706b\u5899\u7aef\u53e3\uff0c\u5141\u8bb8\u8fdc\u7a0b\u8fde\u63a5\uff1a sudo ufw allow &lt;\u7aef\u53e3\u53f7&gt; \u767b\u5f55\u540e\u590d\u5236 \u4f8b\u5982\uff1a sudo ufw allow 3306 \u767b\u5f55\u540e\u590d\u5236 \u5728\u5ba2\u6237\u7aef\u7cfb\u7edf\u4e0a\u8fde\u63a5 \u5728\u5ba2\u6237\u7aef\u7cfb\u7edf\u4e0a\uff0c\u4f7f\u7528 MySQL \u5ba2\u6237\u7aef\u5de5\u5177\uff08\u5982 \uff09\u8fdb\u884c\u8fde\u63a5\uff1a mysql -u &lt;\u7528\u6237\u540d&gt; -p -h &lt;\u670d\u52a1\u5668 IP \u5730\u5740&gt; -P [&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-6164","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6164","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=6164"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6164\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6164"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6164"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6164"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}