I finally got the script working. Seems to run smooth on my FreeBSD 4.11system:

MYSQLDUMP="`which mysqldump 2>/dev/null`" ||
MYSQLDUMP="/usr/local/bin/mysqldump"
MYSQLDUMP_ARGS="--opt --extended-insert -h localhost -umyuser -pmypassword
mydb"
ARCHDIR=/backup/mysql
NAME=db_dump

# Remove archives older than 64 days
find ${ARCHDIR} -type f -mtime +64 | xargs rm -f
# Create new archives
cd ${ARCHDIR} && ${MYSQLDUMP} ${MYSQLDUMP_ARGS} > ${NAME}.`date +%Y%m%d`

I just have two more questions:

Should I use --extended-insert or not? I guess I can use both, but what is
recommended?

What would the correct script/way to restore the database?

Thanks,
Andreas

Reply via email to