简体   繁体   English

使用批处理脚本将mysql表导出到csv文件

[英]export mysql table to csv file using batch script

I am trying to export mysql table data to csv file using batch file. 我正在尝试使用批处理文件将mysql表数据导出到csv文件。 It works on the screen but not able to ouptut to a csv file. 它可以在屏幕上运行,但不能输出到csv文件。

 @echo off
    " C:\ProgramFiles\MYSQL\MYSQL Workbench 6.3 CE\mysql.exe" mysql -uroot -ppassword -e "select plate form SWP;" > \output.csv
    pause
    exit

mysql got a feature for this : LOAD DATA INFILE This will load the content of a query in a file. mysql为此提供了一个功能:LOAD DATA INFILE这将把查询的内容加载到文件中。

Check the doc here : 在此处检查文档:

https://dev.mysql.com/doc/refman/5.7/en/load-data.html https://dev.mysql.com/doc/refman/5.7/en/load-data.html

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM