Skip to content

Instantly share code, notes, and snippets.

@grandmanitou
Created December 16, 2013 20:15
Show Gist options
  • Save grandmanitou/7993601 to your computer and use it in GitHub Desktop.
Save grandmanitou/7993601 to your computer and use it in GitHub Desktop.
Dump all databases from mysql - one file per database - then compress to zip
mysql -s -r -uadmin -p`cat /etc/psa/.psa.shadow` -e 'show databases' | while read db; do mysqldump -uadmin -p`cat /etc/psa/.psa.shadow` $db -r ${db}.sql; [[ $? -eq 0 ]] && zip ${db}.zip ${db}.sql -r9; done
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment