{"id":6471,"date":"2024-11-14T14:07:30","date_gmt":"2024-11-14T06:07:30","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6471\/"},"modified":"2024-11-14T14:07:30","modified_gmt":"2024-11-14T06:07:30","slug":"%e6%80%8e%e4%b9%88%e6%9f%a5%e7%9c%8bmysql%e6%95%b0%e6%8d%ae%e5%ba%93%e7%ab%af%e5%8f%a3","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6471\/","title":{"rendered":"\u600e\u4e48\u67e5\u770bmysql\u6570\u636e\u5e93\u7aef\u53e3"},"content":{"rendered":"<blockquote><p>\n  \u8981\u67e5\u770b mysql \u6570\u636e\u5e93\u7aef\u53e3\uff0c\u8bf7\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff0c\u6267\u884c show variables like &#8216;%port%&#8217;; \u547d\u4ee4\uff0c\u5e76\u5728\u8f93\u51fa\u4e2d\u67e5\u627e port \u53d8\u91cf\u7684\u503c\u3002\u793a\u4f8b\uff1amysql&gt; show variables like &#8216;%port%&#8217;;\uff0c+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ | variable_name | value | +&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ | port | 3306 | +&#8212;&#8212;&#8212;&#8212;&#8212;\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080508104153696.jpg\" class=\"aligncenter\" title=\"\u600e\u4e48\u67e5\u770bmysql\u6570\u636e\u5e93\u7aef\u53e3\u63d2\u56fe\" alt=\"\u600e\u4e48\u67e5\u770bmysql\u6570\u636e\u5e93\u7aef\u53e3\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u67e5\u770b MySQL \u6570\u636e\u5e93\u7aef\u53e3<\/strong><\/p>\n<p>\u8981\u67e5\u770b MySQL \u6570\u636e\u5e93\u7aef\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a<\/p>\n<p><strong>1. \u8fde\u63a5\u5230 MySQL<\/strong><\/p>\n<p>\u4f7f\u7528\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\u3002<\/p>\n<ul>\n<li>macOS\/Linux\uff1a -u username -p password<\/li>\n<li>Windows\uff1amysql -u username -p -P port<\/li>\n<\/ul>\n<p><strong>2. \u6267\u884c\u547d\u4ee4<\/strong><\/p>\n<p>\u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u53ef\u67e5\u770b MySQL \u76d1\u542c\u7684\u7aef\u53e3\uff1a<\/p>\n<pre>SHOW VARIABLES LIKE '%port%';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>3. \u67e5\u627e\u7aef\u53e3\u503c<\/strong><\/p>\n<p>\u5728\u8f93\u51fa\u4e2d\uff0c\u67e5\u627e port \u53d8\u91cf\u7684\u503c\u3002\u8be5\u503c\u5373\u4e3a MySQL \u76d1\u542c\u7684\u7aef\u53e3\u3002<\/p>\n<p><strong>\u793a\u4f8b\uff1a<\/strong><\/p>\n<pre>mysql&gt; SHOW VARIABLES LIKE '%port%';\n+---------------+-------+\n| Variable_name | Value |\n+---------------+-------+\n| port           | 3306  |\n+---------------+-------+\n1 row in set (0.00 sec)\n\nmysql&gt;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u5728\u793a\u4f8b\u4e2d\uff0cMySQL \u7aef\u53e3\u8bbe\u7f6e\u4e3a 3306\u3002<\/p>\n<p><strong>\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u5982\u679c\u60a8\u6ca1\u6709\u6307\u5b9a\u7aef\u53e3\uff08\u4f8b\u5982\u5728 -P \u9009\u9879\u4e2d\uff09\uff0cMySQL \u5c06\u4f7f\u7528\u9ed8\u8ba4\u7aef\u53e3 3306\u3002<\/li>\n<li>\u60a8\u8fd8\u53ef\u4ee5\u901a\u8fc7\u67e5\u770b MySQL \u914d\u7f6e\u6587\u4ef6\uff08\u5982 \/etc\/mysql\/my.cnf\uff09\u6765\u67e5\u627e\u7aef\u53e3\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u600e\u4e48\u67e5\u770b\u6570\u636e\u5e93\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>\u8981\u67e5\u770b mysql \u6570\u636e\u5e93\u7aef\u53e3\uff0c\u8bf7\u8fde\u63a5\u5230\u670d\u52a1\u5668\uff0c\u6267\u884c show variables like &#8216;%port%&#8217;; \u547d\u4ee4\uff0c\u5e76\u5728\u8f93\u51fa\u4e2d\u67e5\u627e port \u53d8\u91cf\u7684\u503c\u3002\u793a\u4f8b\uff1amysql&gt; show variables like &#8216;%port%&#8217;;\uff0c+&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ | variable_name | value | +&#8212;&#8212;&#8212;&#8212;&#8212;+&#8212;&#8212;-+ | port | 3306 | +&#8212;&#8212;&#8212;&#8212;&#8212; \u5982\u4f55\u67e5\u770b MySQL \u6570\u636e\u5e93\u7aef\u53e3 \u8981\u67e5\u770b MySQL \u6570\u636e\u5e93\u7aef\u53e3\uff0c\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u6b65\u9aa4\uff1a 1. \u8fde\u63a5\u5230 MySQL \u4f7f\u7528\u7ec8\u7aef\u6216\u547d\u4ee4\u63d0\u793a\u7b26\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\u3002 macOS\/Linux\uff1a -u username -p password Windows\uff1amysql -u username -p -P port 2. \u6267\u884c\u547d\u4ee4 \u6267\u884c\u4ee5\u4e0b\u547d\u4ee4\u53ef\u67e5\u770b MySQL \u76d1\u542c\u7684\u7aef\u53e3\uff1a SHOW [&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-6471","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6471","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=6471"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6471\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6471"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6471"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6471"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}