Case: I had many .sql-files from a backup containing one table-dump each which should be loaded into another MySql-DB.
Simply using phpMyAdmin would not have worked with regard to the size of the tables. So I was thinking about a way to do it on the commandline under Linux. A foreach-solution would have caused me to enter the MySql password for each file… which was what I wanted to avoid since the DB contained 70 tables.
Solution: I concatenated all .sql files into one and imported it into MySql in one go. Supposed your present working directory is the directory containing all .sql-files do the following:
cat *.sql >> ../complete_dump.sql;
mysql my_database -h mysql_host -u myuser -p < complete_dump.sql;
And your’re done!