简体   繁体   中英

Importing a single column CSV into MySQL

I am having some trouble importing a CSV file with 232 million rows into a MySQL database table. I am trying to use the following code:

LOAD DATA INFILE 'MyCSV.csv' INTO TABLE MyTable
FIELDS TERMINATED BY ''
ENCLOSED '\N'
LINES TERMINATED BY '\r\n'

Part of the problem is the data I am working with is just one 10 digit number per line and no formatting for example:

1234567890 
0987654321
5432167890

I'm trying to account for the fact that I only have one field, so I don't really to worry about what fields are terminated by, but that field doesn't have anything it is enclosed by.

Is there a way I can use infile to import my data without editing the file first?

I would simply use:

LOAD DATA INFILE 'MyCSV.csv' INTO TABLE MyTable
FIELDS TERMINATED BY ',' 
LINES TERMINATED BY '\r\n'

Or maybe just:

LOAD DATA INFILE 'MyCSV.csv' INTO TABLE MyTable

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