Mysql – Import SQL dumps (tables) in folder from shell

MySQL

Im trying to import SQL tables (actually this is files, one file for 1 table), and this is files are too big for importing in phpMyAdmin. It needs to be imported from shell. I know the command "source " to import whole DB. But I'm need to import all *.sql files in folder into one DB. Does mysql have query for this?

P.S. I can't "cat " this file because I'm getting troubles with encoding after this.

Best Answer

Assuming a bash shell, (and for some reason you cannot concat the files together) that is a simple for loop:

for file in *.sql; do mysql **put here your connection parameters** database_name < $file; done