mac mysql 导出数据到excel 中文乱码 解决

使用sql语句导出需要的数据,sql语句不限于单个表的查询。由于我的数据库编码是utf8格式,而office默认的编码则是gb2312,所以当某个字段中包含中文时,导出到excel后,中文内容是会乱码的,此时需要convert转换编码,具体使用方式:

select id,scope,target_name,target_memo,convert(description using gb2312),major_unit,last_major_unit,grayscale_unit,status,delete_by,log_mode into outfile '/Users/puyangsky/Desktop/t.xls' from t_crontab;

原文地址:https://www.cnblogs.com/puyangsky/p/13842334.html