mysqlhotcopy
mysqlhotcopy
is a Perl script that uses a
combination of LOCK
TABLES,
FLUSH
TABLES, and Unix
cp to perform a fast backup of the database. It
simply copies the raw database files to another location. Because it
does only a file copy, it is much faster than
mysqldump. And because the copy is in native
format, the backup is not portable to other hardware or operating
systems, except for MyISAM tables, which are portable. Also,
mysqlhotcopy can be run only on the same host as
the database, whereas mysqldump can be executed
remotely.
To run mysqlhotcopy, type:
$ mysqlhotcopy test /usr/backupsThis command creates a new directory in the /usr/backups directory that has a copy of all the data files in the test database.
If you are using binary logging, you will also want to specify --flushlog, so the binary logs get checkpointed at the time of the backup.
Become an O’Reilly member and get unlimited access to this title plus top books and audiobooks from O’Reilly and nearly 200 top publishers, thousands of courses curated by job role, 150+ live events each month,
and much more.
Read now
Unlock full access