1,导出表table_a的数据为CSV文件a.csv
windows下的情况:
select * from table_a
into outfile '/tmp/a.csv'
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';
linux下将lines terminated by '\r\n'; 改为lines terminated by '\n';
否则会多出两条空记录
2,将a.csv导入至表table_a
load data infile '/tmp/a.csv'
into table table_a
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';
同理:
linux下将lines terminated by '\r\n'; 改为lines terminated by '\n';
阅读(2749) | 评论(0) | 转发(0) |