Backing MySQL Up

<1 min read

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 {
  notifempty
  daily
  nocreate
  rotate 15
  missingok
  compress
  postrotate
  # 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
  fi
  endscript
}
Logrotate provides all kinds of configuration options. There's really no need to reinvent the wheel.

Comments

2 (Closed)

Marc

Jun 21, 2006

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.
Erik C. Thauvin

Jun 21, 2006

Logrotate does compression too, that's what the "compress" directive is for.

That InnoDB hot backup solution does sound interesting.

E.