[mythtv-users] Backing up mysql database.

sdkovacs sdkovacs at gmail.com
Wed Sep 5 16:02:00 UTC 2007


On 9/5/07, clemens at dwf.com <clemens at dwf.com> wrote:
> Is there any advantage in using one of the mysql backup programs over
> just taring up /var/lib/mysql/mysql and /var/lib/mysql/mythconverg ?

The advantages have already been mentioned in this thread, and in case
others are interested, here is a short script i run daily in cron to
backup the mythconverg database. It automatically overwrites the
backup from the previous week so you always will have 7 days of
backups. Additionally, the cp statement at the end of the script
copies the db dump to another physical disk in case of a root disk
crash.
Edit the script as needed.

#! /bin/bash
#
# Created on 3/22/2006 by sdkovacs
# Script: mythbackup
#
#
#
#
########################################################
BACKFILE="/home/mythtv/mythbackup.`date +%a`.sql.gz"


mysqldump -u mythtv -pmythtv mythconverg -c | gzip -c > ${BACKFILE}
if [ $? -ne "0" ]
then
        echo "Mythtv database backup failed! Exiting..."
        exit 1
fi

cp ${BACKFILE} /videos/backup/myth


More information about the mythtv-users mailing list