码迷,mamicode.com
首页 > 数据库 > 详细

【MySQL】数据导出成CSV格式

时间:2014-11-18 23:05:16      阅读:261      评论:0      收藏:0      [点我收藏+]

标签:style   blog   io   color   ar   os   sp   文件   数据   

一、自动输出中文字符集

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格式

标签:style   blog   io   color   ar   os   sp   文件   数据   

原文地址:http://www.cnblogs.com/jiangxu67/p/4106205.html

踩
(0)
赞
(0)
   
举报
评论 一句话评论(0)
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!