backup script using sqldump and table files


I’m looking for a bash backup script that will do the following:

  1. Use mysqldump to dump the data into individual files, one for each table.

  2. Tar and compress the dump, removing the individual files.

  3. Store the tar file using a date format, something like “backup-yyyymmdd”.

  4. Remove files that are 7 days or older

I’m familiar with mysqldump, less familiar with using bash.

Found this article which is pretty close to what I’m looking for.