亂碼原因:
mysql的編碼為utf8,而windows下的excel默認為GB2312
方法一:
導出excel文件為name.xls:
mysql -uroot -p -h"127.0.0.1" -e "select * from tablex where name = 'alen'" >/tmp/name.xls
用notepad++打開,並選擇編碼格式為ANSI,保存,重新用excle打開,大功告成。
方法二:
linux服務器安裝iconv工具,轉碼
iconv -f utf8 -t gb2312 -otype1.xls type.xls
我測試的時候失敗了:iconv: illegal input
sequence
at
position 1841