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

时间:2021-09-13 17:21:55

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格式+乱码解决

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

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