{"id":6155,"date":"2024-11-14T11:15:03","date_gmt":"2024-11-14T03:15:03","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6155\/"},"modified":"2024-11-14T11:15:03","modified_gmt":"2024-11-14T03:15:03","slug":"%e5%a6%82%e4%bd%95%e7%9f%a5%e9%81%93mysql%e7%9a%84%e8%b7%af%e5%be%84","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6155\/","title":{"rendered":"\u5982\u4f55\u77e5\u9053mysql\u7684\u8def\u5f84"},"content":{"rendered":"<p><strong>\u5982\u4f55\u627e\u5230  \u7684\u8def\u5f84<\/strong><\/p>\n<p><strong>\u65b9\u6cd5 1\uff1a\u4f7f\u7528 MySQL \u547d\u4ee4<\/strong><\/p>\n<p>\u4f7f\u7528 which \u547d\u4ee4\uff0c\u540e\u8ddf MySQL \u53ef\u6267\u884c\u6587\u4ef6\uff1a<\/p>\n<pre>which mysql<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u65b9\u6cd5 2\uff1a\u68c0\u67e5\u73af\u5883\u53d8\u91cf<\/strong><\/p>\n<p>MySQL \u8def\u5f84\u901a\u5e38\u5b58\u50a8\u5728 PATH \u73af\u5883\u53d8\u91cf\u4e2d\u3002\u8981\u68c0\u67e5\u5b83\uff0c\u8bf7\u4f7f\u7528\uff1a<\/p>\n<pre>echo $PATH<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u627e\u5230\u5305\u542b MySQL \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\uff0c\u683c\u5f0f\u7c7b\u4f3c\u4e8e\uff1a<\/p>\n<pre>\/usr\/local\/mysql\/bin:\/usr\/bin:\/usr\/sbin<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>\u65b9\u6cd5 3\uff1a\u4f7f\u7528 MySQL \u5ba2\u6237\u7aef<\/strong><\/p>\n<p>\u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\u5e76\u6267\u884c\u4ee5\u4e0b\u67e5\u8be2\uff1a<\/p>\n<pre>SELECT @@basedir;<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p>\u8be5\u67e5\u8be2\u5c06\u8fd4\u56de MySQL \u5b89\u88c5\u7684\u57fa\u76ee\u5f55\u3002<\/p>\n<p><strong>\u5176\u4ed6\u63d0\u793a\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e0d\u540c\u7684 Linux \u53d1\u884c\u7248\u548c MySQL \u7248\u672c\u53ef\u80fd\u7565\u6709\u4e0d\u540c\u3002<\/li>\n<li>\u5982\u679c MySQL \u662f\u4f5c\u4e3a\u670d\u52a1\u5b89\u88c5\u7684\uff0c\u8def\u5f84\u53ef\u80fd\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff08\u4f8b\u5982 \/etc\/my.cnf\uff09\u3002<\/li>\n<li>\u5bf9\u4e8e Windows \u7cfb\u7edf\uff0cMySQL \u8def\u5f84\u901a\u5e38\u5b58\u50a8\u5728\u6ce8\u518c\u8868\u4e2d\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u77e5\u9053\u7684\u8def\u5f84\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\u627e\u5230 \u7684\u8def\u5f84 \u65b9\u6cd5 1\uff1a\u4f7f\u7528 MySQL \u547d\u4ee4 \u4f7f\u7528 which \u547d\u4ee4\uff0c\u540e\u8ddf MySQL \u53ef\u6267\u884c\u6587\u4ef6\uff1a which mysql \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5 2\uff1a\u68c0\u67e5\u73af\u5883\u53d8\u91cf MySQL \u8def\u5f84\u901a\u5e38\u5b58\u50a8\u5728 PATH \u73af\u5883\u53d8\u91cf\u4e2d\u3002\u8981\u68c0\u67e5\u5b83\uff0c\u8bf7\u4f7f\u7528\uff1a echo $PATH \u767b\u5f55\u540e\u590d\u5236 \u627e\u5230\u5305\u542b MySQL \u53ef\u6267\u884c\u6587\u4ef6\u7684\u76ee\u5f55\uff0c\u683c\u5f0f\u7c7b\u4f3c\u4e8e\uff1a \/usr\/local\/mysql\/bin:\/usr\/bin:\/usr\/sbin \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5 3\uff1a\u4f7f\u7528 MySQL \u5ba2\u6237\u7aef \u8fde\u63a5\u5230 MySQL \u670d\u52a1\u5668\u5e76\u6267\u884c\u4ee5\u4e0b\u67e5\u8be2\uff1a SELECT @@basedir; \u767b\u5f55\u540e\u590d\u5236 \u8be5\u67e5\u8be2\u5c06\u8fd4\u56de MySQL \u5b89\u88c5\u7684\u57fa\u76ee\u5f55\u3002 \u5176\u4ed6\u63d0\u793a\uff1a \u4e0d\u540c\u7684 Linux \u53d1\u884c\u7248\u548c MySQL \u7248\u672c\u53ef\u80fd\u7565\u6709\u4e0d\u540c\u3002 \u5982\u679c MySQL \u662f\u4f5c\u4e3a\u670d\u52a1\u5b89\u88c5\u7684\uff0c\u8def\u5f84\u53ef\u80fd\u5728\u914d\u7f6e\u6587\u4ef6\u4e2d\uff08\u4f8b\u5982 \/etc\/my.cnf\uff09\u3002 \u5bf9\u4e8e Windows \u7cfb\u7edf\uff0cMySQL \u8def\u5f84\u901a\u5e38\u5b58\u50a8\u5728\u6ce8\u518c\u8868\u4e2d\u3002 [&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-6155","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6155","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=6155"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6155\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6155"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6155"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6155"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}