You can import data from CSV (Comma-Separated Values) files directly to MySQL tables using LOAD DATA statement or by using MySQL’s own mysqlimport tool.

To be able to import the files, you’ll need to be able to figure out the following properties of the CSV files;

  • Line terminator
  • Field terminator
  • Field enclosure

The following example is for importing source.csv with the following content into target_db.target_table;

"aa","ab","ac"
"ba","bb","bc"
"ca","cb","cc"