您的位置:首页 > 博客中心 > 数据库 >

【MySQL】数据导出成CSV格式

时间:2022-03-14 02:39

一、自动输出中文字符集

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

 

热门排行

今日推荐

热门手游