HiveBrain v1.2.0
Get Started
← Back to all entries
patternsqlMinor

Inserting all csv files into a table in MySQL

Submitted by: @import:stackexchange-dba··
0
Viewed 0 times
allintocsvmysqlfilesinsertingtable

Problem

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.

Solution

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).

Context

StackExchange Database Administrators Q#57830, answer score: 3

Revisions (0)

No revisions yet.