Backing up a MySQL database - while it is still in use

  • If you use InnoDB, you can concurrently read and write. You probably want to use InnoDB if you aren't already.
  • Using InnoDB allows you to run a backup with the --single-transaction flag. This will keep the database in a consistent state and dump live while allowing other transactions to process.
  • If you have a sufficiently large database (it sounds like you might get by without this), then you need something else. There is an official for-pay InnoDB hot backup solution, but I shy away from such an idea. If you're in the spot of needing that, look at http://www.percona.com/docs/wiki/percona-xtrabackup:start

Try having a look at mysqlhotcopy- depending to your database size/tables etc, this might provide you with the answer.


If your storage engine is InnoDB, you can get a consistent mysqldump of a live database by using the --single-transaction flag (as long as you don't change your table structures during the backup). But it doesn't work with MyISAM.