`
brxonline
  • 浏览: 61564 次
  • 性别: Icon_minigender_1
  • 来自: 苏州
社区版块
存档分类
最新评论

mysql导出数据为excel

阅读更多
1.导出
select * from test  outfile '/tmp/reg.xls'
将导出数据放在/tmp目录下
2.编码转换
因为excel默认编码是GB3212,数据中有中文是需进行转换,转换命令
iconv -futf8 -tgb2312 -oreg2.xls reg.xls
转换如果失败:
iconv: illegal input sequence at position 1841 类似于这样的错误,先把reg.xls下载下来,这个时候文件是utf-8编码的,用excel打开,乱码。把reg.xls以文本方式打开,然后另存为,在编码选择ANSI编码,保存。乱码问题就解决了.
分享到:
评论
3 楼 brxonline 2011-05-16  
提示不能这样写
234390216 写道
234390216 写道
不行啊,错误

提示不能这样写

什么错误,贴出来
2 楼 234390216 2011-04-28  
234390216 写道
不行啊,错误

提示不能这样写
1 楼 234390216 2011-04-28  
不行啊,错误

相关推荐

Global site tag (gtag.js) - Google Analytics