How to import a csv file into a mysql database

To import a csv file into mysql, first we need to generate the csv file just with the fields that we need, then go to the mysql prompt an type:

LOAD DATA LOCAL INFILE ‘/path/to/my/csv/file/file.csv’ INTO TABLE my_table FIELDS TERMINATED BY ‘,’ LINES TERMINATED BY ‘\n’ (field1, field2, field3);

For more information consult the mysql documentation here