MySQL LOAD DATA INFILE Import a CSV file into a MySQL table

Help us to keep this website almost Ad Free! It takes only 10 seconds of your time:
> Step 1: Go view our video on YouTube: EF Core Bulk Extensions
> Step 2: And Like the video. BONUS: You can also share it!

Example

The following command imports CSV files into a MySQL table with the same columns while respecting CSV quoting and escaping rules.

load data infile '/tmp/file.csv'
into table my_table
fields terminated by ','
optionally enclosed by '"'
escaped by '"'
lines terminated by '\n'
ignore 1 lines; -- skip the header row


Got any MySQL Question?