I have 9 databases in MySQL that need to be backed up, so I wrote a bash script that:
- Creates folder /backups/SQL_BACK-yymmdd
- For each of the databases, uses mysqldump to generate a backup file (in the above folder) named dbname-yymmdd.sql.
- After completing for all the databases, then generates a tar.gz of the folder. The compressed file is named /backups/SQL_BACK-yymmdd.tar.gz
The uncompressed files total around 100 MB while the compressed file is only about 19 MB.
The bash script runs under cron at around 10:30pm.
The next version of the script will email the compressed file to my gmail account.