50万条数据保存到数据库

xiaoxiao2021-02-27  665

load data infile 'D:/yaoding/gitDataSource/ceeasPython/sqlFiles/insertCollegeCutoff.txt' ignore into table college_cutoff fields terminated by ',' enclosed by '"' lines terminated by '\r\n' (`COLLEGEID`,`PROVINCE`,`GENERA`,`BATCH`,`YEAR`,`HSCORE`,`ASCORE`,`CSCORE`,`NUMBER`);

如果报secure_file_priv的问题先看

show variables like '%secure%';

修改my.ini

 secure_file_priv=d:\

通过load data infile 导入txt文件,windows上的换行符是\r\n,字段分隔符是",ignore into table 忽略唯一索引

详细内容参看http://hunan.iteye.com/blog/752606

转载请注明原文地址: https://www.6miu.com/read-576.html

最新回复(0)