Last active
September 30, 2022 08:41
-
-
Save TheAndrey/2b9b3484f116bfbf0dba8eb782ccbdf8 to your computer and use it in GitHub Desktop.
MySQL Backup
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#!/bin/bash | |
for dbname in `echo SHOW DATABASES | mysql | grep -v Database`; | |
do | |
case $dbname in | |
information_schema) | |
continue ;; | |
mysql) | |
continue ;; | |
performance_schema) | |
continue ;; | |
test) | |
continue ;; | |
sys) | |
continue ;; | |
*) | |
echo "Dumping: $dbname" | |
mysqldump --routines --hex-blob --skip-comments --complete-insert --lock-all-tables $dbname --result-file=$dbname.sql && gzip $dbname.sql ;; | |
esac | |
done; |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment