Erik's Weblog 2.0

June 20, 2006 +2 more...


Backing MySQL Up

I've seen quite some talk about various Automatic MySQL Backup scripts. Maybe I'm missing the point, but backing up MySQL databases is not rocket science. I use a very simple logrotate script:

/etc/logrotate.d /mysql-backup
/opt/backups/mysql-backup.sql {
  rotate 15
  # just if mysqld is really running
  if test -n "`ps acx|grep mysqld`"; then
    /usr/bin/mysqldump --user=USER --password=PASSWORD --add-drop-table --add-locks --all --extended-insert --quick -A > /opt/backups/mysql-backup.sql

Logrotate provides all kinds of configuration options. There's really no need to reinvent the wheel.



Jun 21, 2006 at 00:13

Well the script you referenced seems to do some neat things like compression, sending it to a server, etc. An even more interesting option is that MySQL AB sells software that can do hot backups of InnoDB databases.

Post a comment

Comment Preview