This article assumes a few things before you run the command:
- You are running the command inside the directory where your backups reside
- All of the SQL backup files are decompressed and filename ends in .sql
- The databases have already been created on the server
Run this as one single command:
for dbfile in *.sql
do
db=${dbfile//.sql/}
echo "Importing database: $db from $dbfile"
mysql "$db" < "$dbfile"
echo "Done importing $db"
echo
done