MySQL Import – How to Insert All CSV Files into a Table

csvimportMySQL

I am looking for a way to insert all my csv files into MySQL without having to write several LOAD DATA INFILE statements.

I have many csv files I need to insert and the files themselves are very large.

I have tried *.csv, but this does not work.

Best Answer

See these previous answers:

https://stackoverflow.com/questions/8538995/how-to-import-multiple-csv-files-into-a-mysql-database

https://stackoverflow.com/questions/6552042/mysql-loading-multiple-files-into-a-table

Essentially, no. But it's easy to script this to get a similar result (e.g. one command to import multiple files using a loop).