Using LOAD DATA INFILE
. The example in the docs for CSV is:
LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;
You should remove the IGNORE 1 LINES
clause if there is no header row in the CSV data.
Also, note that the order of the data in the file should match the order of the columns in the table. If they do not, you will need to specify the order like this:
LOAD DATA INFILE 'data.txt' INTO TABLE tbl_name
(column1, column2, ...)
FIELDS TERMINATED BY ',' ENCLOSED BY '"'
LINES TERMINATED BY '\r\n'
IGNORE 1 LINES;