1. 从mysql中导出csv文件
echo "select * from table into outfile '/tmp/table.csv' fields terminated by ',' escaped by '\\' lines terminated by '\n';"|/usr/bin/mysql -uroot database
2. 将csv文件导入到mysql中
echo "load data infile "/tmp/table.csv" replace into table table fields escaped by '\\' terminated by ',' lines terminated by '\n';"|/usr/bin/mysql -uroot database
3. 从linux中取出windows可以编辑的csv文件
unix2dos table.csviconv -f utf8 -t gbk table.csv > newtable.csv
4. 将windows编辑好文件放到linux中
dos2unix newtable.csviconv -f gbk -t utf8 newtable.csv > table.csv