首页 > 代码库 > 【MySQL】数据导出成CSV格式

【MySQL】数据导出成CSV格式

一、自动输出中文字符集

select * from db into outfile test.csv CHARACTER SET gbk fields terminated by , optionally enclosed by " escaped by " lines terminated by \r\n;

 

二、导出后转换字符集

转换成CSV文件,如果乱码将CSV已记事本打开另存为UTF8

select * from db into outfile test.csv fields terminated by , optionally enclosed by ‘‘ lines terminated by \n;

 

【MySQL】数据导出成CSV格式