您的位置:首页 > 数据库 > MySQL

mysql导出,导入csv文件 多出空记录

2016-05-18 23:27 681 查看


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';

内容来自用户分享和网络整理,不保证内容的准确性,如有侵权内容,可联系管理员处理 点击这里给我发消息
标签: