{"id":6560,"date":"2024-11-14T08:03:50","date_gmt":"2024-11-14T00:03:50","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6560\/"},"modified":"2024-11-14T08:03:50","modified_gmt":"2024-11-14T00:03:50","slug":"mysql%e6%95%b0%e6%8d%ae%e5%ba%93%e6%80%8e%e4%b9%88%e7%a6%81%e6%ad%a2%e5%af%bc%e5%87%ba","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6560\/","title":{"rendered":"mysql\u6570\u636e\u5e93\u600e\u4e48\u7981\u6b62\u5bfc\u51fa"},"content":{"rendered":"<blockquote><p>\n  mysql \u63d0\u4f9b\u4e24\u79cd\u65b9\u6cd5\u9650\u5236\u5bfc\u51fa\u6743\u9650\uff1a1. \u6388\u4e88 select\u3001insert \u6743\u9650\u4f46\u4e0d\u6388\u4e88 select into outfile \u6743\u9650\uff1b2. \u66f4\u6539\u6570\u636e\u6587\u4ef6\u7684\u76ee\u5f55\u6743\u9650\uff0c\u4f7f\u5176\u4ec5\u5bf9\u6570\u636e\u5e93\u7528\u6237\u53ef\u5199\uff0c\u9632\u6b62\u5176\u4ed6\u7528\u6237\u8bbf\u95ee\u6570\u636e\u6587\u4ef6\u5bfc\u51fa\u6570\u636e\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202408\/05\/2024080520245944144.jpg\" class=\"aligncenter\" title=\"mysql\u6570\u636e\u5e93\u600e\u4e48\u7981\u6b62\u5bfc\u51fa\u63d2\u56fe\" alt=\"mysql\u6570\u636e\u5e93\u600e\u4e48\u7981\u6b62\u5bfc\u51fa\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u7981\u6b62 MySQL \u6570\u636e\u5e93\u5bfc\u51fa<\/strong><\/p>\n<p>MySQL \u63d0\u4f9b\u4e86\u51e0\u79cd\u65b9\u6cd5\u6765\u9650\u5236\u7528\u6237\u5bf9\u6570\u636e\u5e93\u7684\u5bfc\u51fa\u6743\u9650\u3002\u4ee5\u4e0b\u662f\u4e24\u79cd\u6700\u5e38\u7528\u7684\u65b9\u6cd5\uff1a<\/p>\n<p><strong>\u65b9\u6cd5 1\uff1a\u4f7f\u7528\u6570\u636e\u5e93\u6743\u9650<\/strong><\/p>\n<ul>\n<li>\u6388\u4e88\u7528\u6237 SELECT \u548c INSERT \u6743\u9650\uff0c\u4f46\u4e0d\u6388\u4e88 SELECT INTO OUTFILE \u6743\u9650\u3002\u8fd9\u6837\u53ef\u4ee5\u9632\u6b62\u7528\u6237\u5c06\u6570\u636e\u5bfc\u51fa\u5230\u6587\u4ef6\u3002<\/li>\n<li>\n<p>\u793a\u4f8b SQL \u8bed\u53e5\uff1a<\/p>\n<pre>GRANT SELECT, INSERT ON *.* TO 'user'@'host';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>\u65b9\u6cd5 2\uff1a\u4f7f\u7528\u6587\u4ef6\u7cfb\u7edf\u6743\u9650<\/strong><\/p>\n<ul>\n<li>\u66f4\u6539\u6570\u636e\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u7684\u6743\u9650\uff0c\u4f7f\u5176\u4ec5\u5bf9\u6570\u636e\u5e93\u7528\u6237\u53ef\u5199\u3002\u8fd9\u6837\u53ef\u4ee5\u9632\u6b62\u5176\u4ed6\u7528\u6237\u8bbf\u95ee\u6570\u636e\u6587\u4ef6\u5e76\u5bfc\u51fa\u6570\u636e\u3002<\/li>\n<li>\n<p>\u793a\u4f8b\u547d\u4ee4\uff1a<\/p>\n<pre>chmod 600 \/path\/to\/data_directory<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f\u4e8b\u9879\uff1a<\/strong><\/p>\n<ul>\n<li>\u4e0a\u8ff0\u65b9\u6cd5\u53ea\u80fd\u9632\u6b62\u7528\u6237\u4f7f\u7528 MySQL \u5de5\u5177\u5bfc\u51fa\u6570\u636e\u3002<\/li>\n<li>\u5982\u679c\u7528\u6237\u6709\u5bf9\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684 root \u6743\u9650\uff0c\u4ed6\u4eec\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u8bbf\u95ee\u6570\u636e\u6587\u4ef6\u6765\u5bfc\u51fa\u6570\u636e\u3002<\/li>\n<li>\u4e3a\u4e86\u83b7\u5f97\u66f4\u597d\u7684\u5b89\u5168\u6027\uff0c\u5efa\u8bae\u7ed3\u5408\u4f7f\u7528\u8fd9\u4e24\u79cd\u65b9\u6cd5\uff0c\u5e76\u5c06\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c\u6570\u636e\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u653e\u5728\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u6570\u636e\u5e93\u600e\u4e48\u7981\u6b62\u5bfc\u51fa\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 \u63d0\u4f9b\u4e24\u79cd\u65b9\u6cd5\u9650\u5236\u5bfc\u51fa\u6743\u9650\uff1a1. \u6388\u4e88 select\u3001insert \u6743\u9650\u4f46\u4e0d\u6388\u4e88 select into outfile \u6743\u9650\uff1b2. \u66f4\u6539\u6570\u636e\u6587\u4ef6\u7684\u76ee\u5f55\u6743\u9650\uff0c\u4f7f\u5176\u4ec5\u5bf9\u6570\u636e\u5e93\u7528\u6237\u53ef\u5199\uff0c\u9632\u6b62\u5176\u4ed6\u7528\u6237\u8bbf\u95ee\u6570\u636e\u6587\u4ef6\u5bfc\u51fa\u6570\u636e\u3002 \u5982\u4f55\u7981\u6b62 MySQL \u6570\u636e\u5e93\u5bfc\u51fa MySQL \u63d0\u4f9b\u4e86\u51e0\u79cd\u65b9\u6cd5\u6765\u9650\u5236\u7528\u6237\u5bf9\u6570\u636e\u5e93\u7684\u5bfc\u51fa\u6743\u9650\u3002\u4ee5\u4e0b\u662f\u4e24\u79cd\u6700\u5e38\u7528\u7684\u65b9\u6cd5\uff1a \u65b9\u6cd5 1\uff1a\u4f7f\u7528\u6570\u636e\u5e93\u6743\u9650 \u6388\u4e88\u7528\u6237 SELECT \u548c INSERT \u6743\u9650\uff0c\u4f46\u4e0d\u6388\u4e88 SELECT INTO OUTFILE \u6743\u9650\u3002\u8fd9\u6837\u53ef\u4ee5\u9632\u6b62\u7528\u6237\u5c06\u6570\u636e\u5bfc\u51fa\u5230\u6587\u4ef6\u3002 \u793a\u4f8b SQL \u8bed\u53e5\uff1a GRANT SELECT, INSERT ON *.* TO &#8216;user&#8217;@&#8217;host&#8217;; \u767b\u5f55\u540e\u590d\u5236 \u65b9\u6cd5 2\uff1a\u4f7f\u7528\u6587\u4ef6\u7cfb\u7edf\u6743\u9650 \u66f4\u6539\u6570\u636e\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u7684\u6743\u9650\uff0c\u4f7f\u5176\u4ec5\u5bf9\u6570\u636e\u5e93\u7528\u6237\u53ef\u5199\u3002\u8fd9\u6837\u53ef\u4ee5\u9632\u6b62\u5176\u4ed6\u7528\u6237\u8bbf\u95ee\u6570\u636e\u6587\u4ef6\u5e76\u5bfc\u51fa\u6570\u636e\u3002 \u793a\u4f8b\u547d\u4ee4\uff1a chmod 600 \/path\/to\/data_directory \u767b\u5f55\u540e\u590d\u5236 \u6ce8\u610f\u4e8b\u9879\uff1a \u4e0a\u8ff0\u65b9\u6cd5\u53ea\u80fd\u9632\u6b62\u7528\u6237\u4f7f\u7528 MySQL \u5de5\u5177\u5bfc\u51fa\u6570\u636e\u3002 \u5982\u679c\u7528\u6237\u6709\u5bf9\u6570\u636e\u5e93\u670d\u52a1\u5668\u7684 root \u6743\u9650\uff0c\u4ed6\u4eec\u4ecd\u7136\u53ef\u4ee5\u901a\u8fc7\u76f4\u63a5\u8bbf\u95ee\u6570\u636e\u6587\u4ef6\u6765\u5bfc\u51fa\u6570\u636e\u3002 \u4e3a\u4e86\u83b7\u5f97\u66f4\u597d\u7684\u5b89\u5168\u6027\uff0c\u5efa\u8bae\u7ed3\u5408\u4f7f\u7528\u8fd9\u4e24\u79cd\u65b9\u6cd5\uff0c\u5e76\u5c06\u6570\u636e\u5e93\u670d\u52a1\u5668\u548c\u6570\u636e\u6587\u4ef6\u6240\u5728\u7684\u76ee\u5f55\u653e\u5728\u4e0d\u540c\u7684\u673a\u5668\u4e0a\u3002 \u4ee5\u4e0a\u5c31\u662f\u6570\u636e\u5e93\u600e\u4e48\u7981\u6b62\u5bfc\u51fa\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},"author":1,"featured_media":0,"comment_status":"closed","ping_status":"","sticky":false,"template":"","format":"standard","meta":{"footnotes":""},"categories":[16],"tags":[],"class_list":["post-6560","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6560","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=6560"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6560\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6560"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6560"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6560"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}