load data infile 'F:/data/1.txt' --CSV/txt文件存放路径
into table student--要将数据导入的表名
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';
如果有中文的话,就加入character set:
load data infile 'F:/data/1.csv' --CSV文件存放路径
into table student character set gb2312 --要将数据导入的表名
fields terminated by ',' optionally enclosed by '"' escaped by '"'
lines terminated by '\r\n';
我的操作:
mysql> load data infile 'G:/data/me.txt'
into table mytable_t
fields terminated by '|'
lines terminated by '\n';
似乎"\r"加进去会有问题,数据只导入了第一行,所以去掉了"\r"