Iterate multiple MySQL tables, export 1 table from each
4 answers
I'm sure there is a more compact way to do this, but it should work.
#!/bin/bash
mysql -B -e "show databases" | egrep -v "Database|information_schema" | while read db;
do
echo "$db";
mysqldump $db TableName > $db.sql
done
You may need to customize your calls mysql
and mysqldump
depending on your connection information.
+4
source to share