MySQL Forums
Forum List  »  Knowledge Base

Re: Import multiple CSV files in one Mysql table.
Posted by: Paul Svirin
Date: September 13, 2009 09:54AM

1. I think the bast way is to split the CSV accroding to your needs befor importing into different files named according to the tables to be imported, e.g.:

head -n -10 a.csv > A.csv
tail -n +10 | head -n 20 > B.csv


then use the mysqlimport statement like the one below with multiple input files:

mysqlimport ... A.csv B.csv ...

2. Try this:

mysqlimport --fields-optionally-enclosed-by="\"" --fields-terminated-by=, --lines-terminated-by="\n" --user=<username> --password <db_name> --local --ignore-lines=1 ./<table_name>.csv

Input file format:


where line 1 is fields caption.

StarWind Software developer ( )

Options: ReplyQuote

Written By
Re: Import multiple CSV files in one Mysql table.
September 13, 2009 09:54AM

Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.