【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;

 

郑重声明:本站内容如果来自互联网及其他传播媒体,其版权均属原媒体及文章作者所有。转载目的在于传递更多信息及用于网络分享,并不代表本站赞同其观点和对其真实性负责,也不构成任何其他建议。