mysql数据导出excel格式+乱码解决

1:导出的SQL命令,只需要加上“FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' ”

select a.contact, a.text, b.nickname, b.create_time into outfile '/tmp/4.csv' FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"' LINES TERMINATED BY '\n' 
from feedback a, user_3 b where a.text like '%XXX+%' and a.user_id = b.id and b.create_time >= '2016-03-28 00:00:00' and b.create_time < '2016-03-29 00:00:00';

2:导出后的CSV打开是乱码,解决乱码问题

mysql数据导出excel格式+乱码解决_第1张图片

3:用notepad打开,在格式里面选择utf8格式编码,保存。再打开就是正常了

mysql数据导出excel格式+乱码解决_第2张图片

 

转载于:https://www.cnblogs.com/zuoxingyu/p/5337124.html

你可能感兴趣的:(mysql数据导出excel格式+乱码解决)