> -----Original Message----- > From: Sparks [mailto:[EMAIL PROTECTED]
> I want to have an automatic backup done of my SQL databases, > but cant quite > figure out how to use mysqldump to do this properly... I use a script that I run as a nightly cron job. Here's the one I use: --- #!/bin/sh DATE=`date +%Y%m%d` cd /var/lib/mysql-backup /usr/bin/mysqldump --user=backup --password=Password --quick --lock-tables --all-databases | gzip >"mysql.$DATE.gz" cd /var/lib/mysql-backup/logs mv update.log "update.$DATE.log" /usr/bin/mysqladmin --user=backup --password=Password flush-logs gzip "update.$DATE.log" --- Obviously you'd want this to be readable only by root, since it contains passwords. The "backup" user will need global SELECT and RELOAD privilages. You could easily modify this to FTP or SCP the files when they're done. If you don't care about the update logs you can simplify a bit and eliminate the RELOAD privilage, but I personally find them useful to have. (With a backup and the update log that follows it, you can restore to any point by restoring the backup, editing the log, then rerunning it against the server.) -- MySQL General Mailing List For list archives: http://lists.mysql.com/mysql To unsubscribe: http://lists.mysql.com/[EMAIL PROTECTED]