Importing CSV Into MySQL

The newer versions of phpMyAdmin for some reason no longer include the option to import CSV files. If you are trying to import an Excel or other delimited file, first make sure that it’s in CSV format (with Excel you can export it as CSV). Then log into phpMyAdmin or your MySQL prompt and run this command:

load data local infile ‘/path/to/file.csv‘ into table yourtablename
fields terminated by ‘,’
enclosed by ‘”‘
lines terminated by ‘\n’;

With phpMyAdmin this is done within the ‘SQL’ section, indicated by the ‘SQL’ tab.

Be Sociable, Share!

Leave a Reply

Your email address will not be published. Required fields are marked *