简体   繁体   中英

Importing a large csv file into mysql database

I have a csv file that has 310 columns and approx 4.8 million rows. I have tried

  • LOAD DATA LOCAL INFILE
  • sql import csv (which is basically the same thing)

I was wondering is there a better and faster method to do that.

create a table with CSV engine , the same column to the CSV file, and copy the CSV to mysql data path, I think this is the fastest way. see: http://dev.mysql.com/doc/refman/5.7/en/csv-storage-engine.html

mysql添加到PATH环境变量中,然后可以使用命令行导入csv文件

mysql  -u <MYSQL_USER>  -p <MYSQL_PASSWORD>  <YOUR_DATABASENAME> < <PATH_TO_YOUR_CSV_FILE>

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM