一:问题描述
最近在使用select * into outfile 'a.csv' from user;的时候发现一个问题,excel直接打开时候是一堆乱码。
二:解决办法
导出时候加上 CHARACTER SET gbk即可。例子如下:INTO OUTFILE 'a.csv'
CHARACTER SET gbk
FIELDS TERMINATED BY ',' OPTIONALLY ENCLOSED BY '"'
LINES TERMINATED BY '\n'
from user a;