50萬條數據保存到數據庫

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

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章