mysql
, The Command-line Tool
mysqladmin
, Administrating a MySQL Server
mysqlbinlog
, Executing the queries from a binary log
mysqlcheck
for Table Maintenance and Crash Recovery
mysqldump
, Dumping Table Structure and Data
mysqlhotcopy
, Copying MySQL Databases and Tables
mysqlimport
, Importing Data from Text Files
mysqlshow
, Showing Databases, Tables, and Columns
mysql_config
, Get compile options for compiling clients
perror
, Explaining Error Codes
mysqlhotcopy
, Copying MySQL Databases and Tables
mysqlhotcopy
is a Perl script that uses LOCK TABLES
,
FLUSH TABLES
and cp
or scp
to quickly make a backup
of a database. It's the fastest way to make a backup of the database
or single tables, but it can only be run on the same machine where the
database directories are. mysqlhotcopy
works only on Unix, and
it works only for MyISAM
and ISAM
tables.
mysqlhotcopy db_name [/path/to/new_directory] mysqlhotcopy db_name_1 ... db_name_n /path/to/new_directory mysqlhotcopy db_name./regex/
mysqlhotcopy
supports the following options:
-?, --help
-u, --user=#
-p, --password=#
-P, --port=#
-S, --socket=#
--allowold
--keepold
--noindices
myisamchk -rq.
.
--method=#
cp
or scp
).
-q, --quiet
--debug
-n, --dryrun
--regexp=#
--suffix=#
--checkpoint=#
--flushlog
--tmpdir=#
You can use perldoc mysqlhotcopy
to get more complete
documentation for mysqlhotcopy
.
mysqlhotcopy
reads the groups [client]
and [mysqlhotcopy]
from the option files.
To be able to execute mysqlhotcopy
you need write access to the
backup directory, the SELECT
privilege for the tables you are about to
copy and the MySQL RELOAD
privilege (to be able to
execute FLUSH TABLES
).
Posted by [name withheld] on Sunday February 9 2003, @3:17pm | [Delete] [Edit] |
--regex=
What sort of regex works here? I can;t get it to match anything
Posted by [name withheld] on Thursday February 13 2003, @2:21am | [Delete] [Edit] |
Since this is a perl script, I think this will be perl regular expressions as discribed in 'perldoc perlre'.
Posted by Ton Voon on Thursday May 29 2003, @2:21am | [Delete] [Edit] |
The manual says that for mysqlhotcopy to work, the user needs the RELOAD priviledge, but this priviledge can be only granted at the database level and not at a table level (at least in mysql 3.23.53).
You can set the grant by:
grant reload on *.* to user@host;
Posted by webmaster on Wednesday June 25 2003, @12:10pm | [Delete] [Edit] |
I couldn't get mysqlhotcopy to work with the privileges the documentation say are required (Select_priv,Reload_priv). I was able to strace the thread and see mysql was returning "access denied" because mysqlhotcopy was trying to do a LOCK query.
If you are getting "access denied", try giving the appropriate user "Lock_tables_priv" and do a "FLUSH PRIVILEGES".
(mysqlhotcopy v1.18)