Import CSV to mysql

23 Oct

To import an Excel file into MySQL, first export it as a CSV file. Remove the CSV headers from the generated CSV file along with empty data that Excel may have put at the end of the CSV file.

You can then import it into a MySQL table by running:

load data local infile 'uniq.csv' into table tblUniq fields terminated by ','
enclosed by '"'
lines terminated by '\n'
(uniqName, uniqCity, uniqComments)

 

 

 

 

One Response to “Import CSV to mysql”

  1. Bruce June 15, 2014 at 6:08 am #

    Hello there, Neat post. I’ll be your frequent visitor.

Leave a comment