Here’s how you would import data into MySQL using a query
/*
If the CSV file was created in Windows, then replace '\n' with '\r\n'
*/
LOAD DATA LOCAL INFILE '/path/to/csv_file.csv' INTO TABLE `table_name`
FIELDS TERMINATED BY ','
OPTIONALLY ENCLOSED BY "\""
LINES TERMINATED BY '\n'
(field1, field2, field3);
Leave a Reply