{"id":6196,"date":"2024-11-14T10:16:06","date_gmt":"2024-11-14T02:16:06","guid":{"rendered":"https:\/\/fwq.ai\/blog\/6196\/"},"modified":"2024-11-14T10:16:06","modified_gmt":"2024-11-14T02:16:06","slug":"mysql%e5%a6%82%e4%bd%95%e5%af%bc%e5%87%baexcel","status":"publish","type":"post","link":"https:\/\/fwq.ai\/blog\/6196\/","title":{"rendered":"mysql\u5982\u4f55\u5bfc\u51faexcel"},"content":{"rendered":"<blockquote><p>\n  \u5982\u4f55\u5728 mysql \u4e2d\u5bfc\u51fa\u6570\u636e\u5230 excel\uff1f\u5bfc\u51fa\u4e3a csv \u6587\u4ef6\uff0c\u7136\u540e\u5728 excel \u4e2d\u5bfc\u5165\u3002\u4f7f\u7528 mysql workbench \u6216 phpmyadmin \u7b49\u5de5\u5177\u5bfc\u51fa\u3002\u8003\u8651\u5206\u9875\u6216\u5206\u5757\u5bfc\u51fa\u5927\u578b\u6570\u636e\u96c6\u3002\n<\/p><\/blockquote>\n<p><img decoding=\"async\" src=\"https:\/\/img.php.cn\/upload\/article\/202406\/14\/2024061406092354233.jpg\" class=\"aligncenter\" title=\"mysql\u5982\u4f55\u5bfc\u51faexcel\u63d2\u56fe\" alt=\"mysql\u5982\u4f55\u5bfc\u51faexcel\u63d2\u56fe\" \/><\/p>\n<p><strong>\u5982\u4f55\u5728 MySQL \u4e2d\u5bfc\u51fa\u6570\u636e\u5230 Excel<\/strong><\/p>\n<p>\u5bfc\u51fa MySQL \u6570\u636e\u5230 Excel \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\uff1a<\/p>\n<p><strong>1. \u5bfc\u51fa\u4e3a CSV \u6587\u4ef6<\/strong><\/p>\n<p>\u4f7f\u7528 SELECT INTO OUTFILE \u8bed\u53e5\u5c06\u6570\u636e\u5bfc\u51fa\u4e3a CSV\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u6587\u4ef6\u3002\u8bed\u6cd5\u5982\u4e0b\uff1a<\/p>\n<pre>SELECT * INTO OUTFILE 'path\/to\/file.csv'\nFIELDS TERMINATED BY ','\nENCLOSED BY '\"'\nLINES TERMINATED BY '\n';<\/pre>\n<p> \u767b\u5f55\u540e\u590d\u5236 <\/p>\n<p><strong>2. \u5728 Excel \u4e2d\u5bfc\u5165 CSV \u6587\u4ef6<\/strong><\/p>\n<p>\u5728 Excel \u4e2d\uff0c\u9009\u62e9 &#8220;\u6570\u636e&#8221; \u9009\u9879\u5361\uff0c\u7136\u540e\u5355\u51fb &#8220;\u4ece\u6587\u672c\/CSV&#8221; \u5bfc\u5165\u6570\u636e\u3002\u9009\u62e9\u5bfc\u51fa\u7684 CSV \u6587\u4ef6\u5e76\u6309\u7167\u5bfc\u5165\u5411\u5bfc\u4e2d\u7684\u6b65\u9aa4\u64cd\u4f5c\u3002<\/p>\n<p><strong>3. \u5176\u4ed6\u65b9\u6cd5<\/strong><\/p>\n<p>\u9664\u4e86\u5bfc\u51fa\u4e3a CSV \u5916\uff0c\u8fd8\u53ef\u4ee5\u4f7f\u7528\u4ee5\u4e0b\u65b9\u6cd5\u5bfc\u51fa MySQL \u6570\u636e\u5230 Excel\uff1a<\/p>\n<ul>\n<li> <strong>\u4f7f\u7528 MySQL Workbench:<\/strong> MySQL Workbench \u662f\u4e00\u6b3e\u7528\u4e8e MySQL \u6570\u636e\u5e93\u7ba1\u7406\u7684\u56fe\u5f62\u5de5\u5177\u3002\u5b83\u63d0\u4f9b\u4e86\u5bfc\u51fa\u6570\u636e\u5230 CSV \u6216 Excel \u683c\u5f0f\u7684\u5185\u7f6e\u529f\u80fd\u3002<\/li>\n<li> <strong>\u4f7f\u7528 PHPMyAdmin:<\/strong> PHPMyAdmin \u662f\u4e00\u6b3e\u57fa\u4e8e web \u7684 MySQL \u7ba1\u7406\u5de5\u5177\u3002\u5b83\u5141\u8bb8\u60a8\u5c06\u6570\u636e\u5bfc\u51fa\u4e3a CSV \u6216 Excel \u683c\u5f0f\u7684\u538b\u7f29\u6587\u4ef6\u3002<\/li>\n<\/ul>\n<p><strong>\u6ce8\u610f:<\/strong><\/p>\n<ul>\n<li>\u786e\u4fdd\u62e5\u6709\u5bfc\u51fa\u6570\u636e\u7684\u6743\u9650\u3002<\/li>\n<li>CSV \u683c\u5f0f\u53ef\u80fd\u4f1a\u4e22\u5931\u67d0\u4e9b\u6570\u636e\u7c7b\u578b\uff0c\u5982\u65e5\u671f\u548c\u65f6\u95f4\u3002\u56e0\u6b64\uff0c\u5efa\u8bae\u5bfc\u51fa\u4e3a Excel \u683c\u5f0f (.xlsx)\u3002<\/li>\n<li>\u5bfc\u51fa\u5927\u578b\u6570\u636e\u96c6\u65f6\uff0c\u5728\u5bfc\u51fa\u4e4b\u524d\u8003\u8651\u4f7f\u7528\u5206\u9875\u6216\u5206\u5757\u5bfc\u51fa\u3002<\/li>\n<\/ul>\n<p>\u4ee5\u4e0a\u5c31\u662f\u5982\u4f55\u5bfc\u51faexcel\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\u5728 mysql \u4e2d\u5bfc\u51fa\u6570\u636e\u5230 excel\uff1f\u5bfc\u51fa\u4e3a csv \u6587\u4ef6\uff0c\u7136\u540e\u5728 excel \u4e2d\u5bfc\u5165\u3002\u4f7f\u7528 mysql workbench \u6216 phpmyadmin \u7b49\u5de5\u5177\u5bfc\u51fa\u3002\u8003\u8651\u5206\u9875\u6216\u5206\u5757\u5bfc\u51fa\u5927\u578b\u6570\u636e\u96c6\u3002 \u5982\u4f55\u5728 MySQL \u4e2d\u5bfc\u51fa\u6570\u636e\u5230 Excel \u5bfc\u51fa MySQL \u6570\u636e\u5230 Excel \u53ef\u4ee5\u901a\u8fc7\u4ee5\u4e0b\u6b65\u9aa4\u5b9e\u73b0\uff1a 1. \u5bfc\u51fa\u4e3a CSV \u6587\u4ef6 \u4f7f\u7528 SELECT INTO OUTFILE \u8bed\u53e5\u5c06\u6570\u636e\u5bfc\u51fa\u4e3a CSV\uff08\u9017\u53f7\u5206\u9694\u503c\uff09\u6587\u4ef6\u3002\u8bed\u6cd5\u5982\u4e0b\uff1a SELECT * INTO OUTFILE &#8216;path\/to\/file.csv&#8217; FIELDS TERMINATED BY &#8216;,&#8217; ENCLOSED BY &#8216;&#8221;&#8216; LINES TERMINATED BY &#8216; &#8216;; \u767b\u5f55\u540e\u590d\u5236 2. \u5728 Excel \u4e2d\u5bfc\u5165 CSV [&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-6196","post","type-post","status-publish","format-standard","hentry","category-16"],"_links":{"self":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6196","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=6196"}],"version-history":[{"count":0,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/posts\/6196\/revisions"}],"wp:attachment":[{"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/media?parent=6196"}],"wp:term":[{"taxonomy":"category","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/categories?post=6196"},{"taxonomy":"post_tag","embeddable":true,"href":"https:\/\/fwq.ai\/blog\/wp-json\/wp\/v2\/tags?post=6196"}],"curies":[{"name":"wp","href":"https:\/\/api.w.org\/{rel}","templated":true}]}}