Name

mysqlhotcopy

Synopsis

mysqlhotcopy database [path]

Use this utility to make backup copies of databases while the server is active. It works only on MyISAM and ISAM tables. It makes a simple copy of each database directory and each table file. This results in a separate directory for each database and usually three files for each table: one for the schema, another for the data, and a third for the index. It places a read lock on all of the tables in the database while copying them. Here is an example of how you can copy a database with mysqlhotcopy:

mysqlhotcopy -u russell -p password workrequests /tmp/backup

Note that unlike other MySQL utilities, there is a space between the -p and the password. Next, specify the database (workrequests). Finally, give the path to write the backup directories. To restore databases or tables that were copied by mysqlhotcopy, just copy the table files to be restored to their original data directories.

mysqlhotcopy options

--addtodest

This option instructs the utility not to abort the session or to rename the backup directory, but to add new files to the directory.

--allowold

This option renames any existing backup directory with an _old suffix so that the copying may be completed. If the new copy is successful, the old directory is deleted. If it’s unsuccessful, the old directory is restored.

--checkpoint=database.table

This option saves logging information to the named database and table.

--chroot=path

This option is used to specify the base directory of ...

Get MySQL in a Nutshell, 2nd Edition now with the O’Reilly learning platform.

O’Reilly members experience books, live events, courses curated by job role, and more from O’Reilly and nearly 200 top publishers.