Skip to content

Instantly share code, notes, and snippets.

@chetan
Last active December 22, 2015 16:09
Show Gist options
  • Save chetan/6497171 to your computer and use it in GitHub Desktop.
Save chetan/6497171 to your computer and use it in GitHub Desktop.
Dump each table to a separate file
DB=foo
for table in `mysql -uroot $DB -e 'show tables' | grep -v '^Tables_in'`; do
echo dumping $table;
mysqldump5 -uroot -t --skip-opt --compact $DB $table > t-$table.sql;
done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment