Skip to content

Instantly share code, notes, and snippets.

@girishsalaskar
Last active December 14, 2019 03:31
Show Gist options
  • Save girishsalaskar/80968698d8f20e88cfe9f40e00f961ff to your computer and use it in GitHub Desktop.
Save girishsalaskar/80968698d8f20e88cfe9f40e00f961ff to your computer and use it in GitHub Desktop.
Dump `mysql` db by tables (See more here : https://codewander.blogspot.com/2019/12/dump-mysql-db-by-tables.html )
for T in `mysql -h <host>-P 3306 -uroot -p -N -B -e 'show tables from YOURDBNAME'`
do
echo "Backing up - $T"
mysqldump --skip-comments --compact -h 127.0.0.1 -P 3306 -uroot -p YOURDBNAME $T > /path/to/destination/folder/$T.sql
done;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment