原博客地址
https://blog.csdn.net/quiet_girl/article/details/71436108
主要改变:
load data infile ‘F:/MySqlData/test1.csv’ --CSV文件存放路径
into table student–要将数据导入的表名
fields terminated by ‘,’ optionally enclosed by ‘"’ escaped by ‘"’
lines terminated by ‘\r\n’;
不知道是不是我电脑的问题,我用的是mac,如果直接使用这个命令的话,会出现Permission Denied的报错,所以需要修改一下:
load data local infile ‘/Users/season/Desktop/毕业设计/ml-latest-small/movies.csv’
into table movies
fields terminated by ‘,’ optionally enclosed by ‘"’ escaped by ‘"’
lines terminated by ‘\r\n’;
实际输入:
load data local infile ‘/Users/season/Desktop/毕业设计/ml-latest-small/ratings.csv’ into table ratings fields terminated by ‘,’ optionally enclosed by ‘"’ escaped by ‘"’ lines terminated by ‘\r\n’;