{"id":6222,"date":"2024-11-14T11:19:30","date_gmt":"2024-11-14T03:19:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6222\/"},"modified":"2024-11-14T11:19:30","modified_gmt":"2024-11-14T03:19:30","slug":"%e5%a6%82%e4%bd%95%e7%9c%8bmysql%e6%95%b0%e6%8d%ae%e5%ba%93%e7%9a%84%e7%ab%af%e5%8f%a3%e5%8f%b7","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6222\/","title":{"rendered":"\u5982\u4f55\u770bmysql\u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7"},"content":{"rendered":"<blockquote><p>\n  mysql \u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u67e5\u770b\uff1a\u4f7f\u7528 show variables like &#8216;%port%&#8217; \u547d\u4ee4\u67e5\u770b mysql \u914d\u7f6e\u6587\u4ef6\uff08windows \u548c linux\/unix\uff09\u8be2\u95ee mysql \u670d\u52a1\u5668\uff08\u4ec5\u9650\u4e8e linux\/unix\uff09\u4f7f\u7528 netstat \u547d\u4ee4\uff08\u4ec5\u9650\u4e8e linux\/unix\uff09\u67e5\u770b mysql \u670d\u52a1\u8bbe\u7f6e\uff08\u4ec5\u9650\u4e8e windows\uff09\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/15\/2024061514273130089.jpg\" class=\"aligncenter\" title=\"\u5982\u4f55\u770bmysql\u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\u63d2\u56fe\" alt=\"\u5982\u4f55\u770bmysql\u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b MySQL \u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7<\/strong><\/p>\n<p>MySQL \u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\u662f\u8fde\u63a5\u6570\u636e\u5e93\u65f6\u5fc5\u586b\u7684\u4e00\u9879\u53c2\u6570\u3002\u4ee5\u4e0b\u4ecb\u7ecd\u51e0\u79cd\u67e5\u770b MySQL \u6570\u636e\u5e93\u7aef\u53e3\u53f7\u7684\u65b9\u6cd5\uff1a<\/p>\n<p><strong>1. \u4f7f\u7528 SHOW VARIABLES LIKE &#8216;%port%&#8217; \u547d\u4ee4<\/strong><\/p>\n<pre>mysql&gt; SHOW VARIABLES LIKE '%port%';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u6b64\u547d\u4ee4\u5c06\u663e\u793a\u6240\u6709\u4e0e\u7aef\u53e3\u76f8\u5173\u7684\u53d8\u91cf\uff0c\u5305\u62ec MySQL \u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002<\/p>\n<p><strong>2. \u67e5\u770b MySQL \u914d\u7f6e\u6587\u4ef6<\/strong><\/p>\n<p>MySQL \u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e \/etc\/my.cnf\uff08Linux\/Unix\uff09\u6216 C:ProgramDataMySQLmy.ini\uff08Windows\uff09\u3002\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u5e76\u67e5\u627e\u4ee5\u4e0b\u884c\uff1a<\/p>\n<pre>port = &lt;\u7aef\u53e3\u53f7&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u8be2\u95ee MySQL \u670d\u52a1\u5668<\/strong><\/p>\n<p>\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u547d\u4ee4\u76f4\u63a5\u8be2\u95ee MySQL \u670d\u52a1\u5668\u5176\u7aef\u53e3\u53f7\uff1a<\/p>\n<pre>mysql&gt; SELECT @@port;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>4. \u4f7f\u7528 netstat \u547d\u4ee4\uff08\u4ec5\u9650\u4e8e Linux\/Unix\uff09<\/strong><\/p>\n<p>netstat \u547d\u4ee4\u53ef\u4ee5\u663e\u793a\u7f51\u7edc\u8fde\u63a5\u7684\u4fe1\u606f\u3002\u4ee5\u4e0b\u547d\u4ee4\u5c06\u5217\u51fa\u6240\u6709\u6b63\u5728\u76d1\u542c 3306 \u7aef\u53e3\uff08\u9ed8\u8ba4 MySQL \u7aef\u53e3\uff09\u7684\u8fdb\u7a0b\uff1a<\/p>\n<pre>netstat -tulpn | grep 3306<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>5. \u67e5\u770b MySQL \u670d\u52a1\u8bbe\u7f6e\uff08Windows\uff09<\/strong><\/p>\n<ul>\n<li>\u6253\u5f00\u201c\u670d\u52a1\u201d\u7ba1\u7406\u5668\uff08services.msc\uff09\u3002<\/li>\n<li>\u627e\u5230\u201cMySQL\u201d\u670d\u52a1\u3002<\/li>\n<li>\u53f3\u952e\u5355\u51fb\u670d\u52a1\u5e76\u9009\u62e9\u201c\u5c5e\u6027\u201d\u3002<\/li>\n<li>\u5728\u201c\u5e38\u89c4\u201d\u9009\u9879\u5361\u4e2d\uff0c\u67e5\u770b\u201c\u7aef\u53e3\u201d\u5b57\u6bb5\u4e2d\u7684\u7aef\u53e3\u53f7\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u770b\u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\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>mysql \u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u65b9\u6cd5\u67e5\u770b\uff1a\u4f7f\u7528 show variables like &#8216;%port%&#8217; \u547d\u4ee4\u67e5\u770b mysql \u914d\u7f6e\u6587\u4ef6\uff08windows \u548c linux\/unix\uff09\u8be2\u95ee mysql \u670d\u52a1\u5668\uff08\u4ec5\u9650\u4e8e linux\/unix\uff09\u4f7f\u7528 netstat \u547d\u4ee4\uff08\u4ec5\u9650\u4e8e linux\/unix\uff09\u67e5\u770b mysql \u670d\u52a1\u8bbe\u7f6e\uff08\u4ec5\u9650\u4e8e windows\uff09 \u5982\u4f55\u67e5\u770b MySQL \u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7 MySQL \u6570\u636e\u5e93\u7684\u7aef\u53e3\u53f7\u662f\u8fde\u63a5\u6570\u636e\u5e93\u65f6\u5fc5\u586b\u7684\u4e00\u9879\u53c2\u6570\u3002\u4ee5\u4e0b\u4ecb\u7ecd\u51e0\u79cd\u67e5\u770b MySQL \u6570\u636e\u5e93\u7aef\u53e3\u53f7\u7684\u65b9\u6cd5\uff1a 1. \u4f7f\u7528 SHOW VARIABLES LIKE &#8216;%port%&#8217; \u547d\u4ee4 mysql&gt; SHOW VARIABLES LIKE &#8216;%port%&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u6b64\u547d\u4ee4\u5c06\u663e\u793a\u6240\u6709\u4e0e\u7aef\u53e3\u76f8\u5173\u7684\u53d8\u91cf\uff0c\u5305\u62ec MySQL \u670d\u52a1\u5668\u7684\u7aef\u53e3\u53f7\u3002 2. \u67e5\u770b MySQL \u914d\u7f6e\u6587\u4ef6 MySQL \u914d\u7f6e\u6587\u4ef6\u901a\u5e38\u4f4d\u4e8e \/etc\/my.cnf\uff08Linux\/Unix\uff09\u6216 C:ProgramDataMySQLmy.ini\uff08Windows\uff09\u3002\u6253\u5f00\u914d\u7f6e\u6587\u4ef6\u5e76\u67e5\u627e\u4ee5\u4e0b\u884c\uff1a port = &lt;\u7aef\u53e3\u53f7&gt; \u767b\u5f55\u540e\u590d\u5236 [&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-6222","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6222","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=6222"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6222\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6222"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6222"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6222"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}