2
3
4
6 mysqlhotcopy - a database backup program
7
9 mysqlhotcopy arguments
10
12 mysqlhotcopy is a Perl script that was originally written and
13 contributed by Tim Bunce. It uses LOCK TABLES, FLUSH TABLES, and cp or
14 scp to make a database backup quickly. It is the fastest way to make a
15 backup of the database or single tables, but it can be run only on the
16 same machine where the database directories are located. mysqlhotcopy
17 works only for backing up MyISAM and ISAM tables, and ARCHIVE tables.
18 It runs on Unix and NetWare.
19
20 shell> mysqlhotcopy db_name [/path/to/new_directory]
21
22 shell> mysqlhotcopy db_name_1 ... db_name_n /path/to/new_directory
23
24 Back up tables in the given database that match a regular expression:
25
26 shell> mysqlhotcopy db_name./regex/
27
28 The regular expression for the table name can be negated by prefixing
29 it with a tilde (‘~’):
30
31 shell> mysqlhotcopy db_name./~regex/
32
33 mysqlhotcopy supports the following options:
34
35 · --help, -?
36
37 Display a help message and exit.
38
39 · --addtodest
40
41 Do not rename target directory (if it exists); merely add files to
42 it.
43
44 · --allowold
45
46 Do not abort if a target exists; rename it by adding an _old suffix.
47
48 · --checkpoint=db_name.tbl_name
49
50 Insert checkpoint entries into the specified database db_name and
51 table tbl_name.
52
53 · --chroot=path
54
55 Base directory of the chroot jail in which mysqld operates. The path
56 value should match that of the --chroot option given to mysqld.
57
58 · --debug
59
60 Enable debug output.
61
62 · --dryrun, -n
63
64 Report actions without performing them.
65
66 · --flushlog
67
68 Flush logs after all tables are locked.
69
70 · --host=host_name, -h host_name
71
72 The hostname of the local host to use for making a TCP/IP connection
73 to the local server. By default, the connection is made to localhost
74 using a Unix socket file.
75
76 · --keepold
77
78 Do not delete previous (renamed) target when done.
79
80 · --method=command
81
82 The method for copying files (cp or scp).
83
84 · --noindices
85
86 Do not include full index files in the backup. This makes the backup
87 smaller and faster. The indexes for reloaded tables can be
88 reconstructed later with myisamchk -rq.
89
90 · --password=password, -ppassword
91
92 The password to use when connecting to the server. Note that the
93 password value is not optional for this option, unlike for other
94 MySQL programs. You can use an option file to avoid giving the
95 password on the command line.
96
97 Specifying a password on the command line should be considered
98 insecure. See Section 6.6, “Keeping Your Password Secure”.
99
100 · --port=port_num, -P port_num
101
102 The TCP/IP port number to use when connecting to the local server.
103
104 · --quiet, -q
105
106 Be silent except for errors.
107
108 · --record_log_pos=db_name.tbl_name
109
110 Record master and slave status in the specified database db_name and
111 table tbl_name.
112
113 · --regexp=expr
114
115 Copy all databases with names that match the given regular
116 expression.
117
118 · --resetmaster
119
120 Reset the binary log after locking all the tables.
121
122 · --resetslave
123
124 Reset the master.info file after locking all the tables.
125
126 · --socket=path, -S path
127
128 The Unix socket file to use for the connection.
129
130 · --suffix=str
131
132 The suffix for names of copied databases.
133
134 · --tmpdir=path
135
136 The temporary directory. The default is /tmp.
137
138 · --user=user_name, -u user_name
139
140 The MySQL username to use when connecting to the server.
141
142
143 mysqlhotcopy reads the [client] and [mysqlhotcopy] option groups from
144 option files.
145
146 To execute mysqlhotcopy, you must have access to the files for the
147 tables that you are backing up, the SELECT privilege for those tables,
148 the RELOAD privilege (to be able to execute FLUSH TABLES), and the LOCK
149 TABLES privilege (to be able to lock the tables).
150
151 Use perldoc for additional mysqlhotcopy documentation, including
152 information about the structure of the tables needed for the
153 --checkpoint and --record_log_pos options:
154
155 shell> perldoc mysqlhotcopy
156
158 Copyright 1997-2007 MySQL AB
159
160 This documentation is NOT distributed under a GPL license. Use of this
161 documentation is subject to the following terms: You may create a
162 printed copy of this documentation solely for your own personal use.
163 Conversion to other formats is allowed as long as the actual content is
164 not altered or edited in any way. You shall not publish or distribute
165 this documentation in any form or on any media, except if you
166 distribute the documentation in a manner similar to how MySQL
167 disseminates it (that is, electronically for download on a Web site
168 with the software) or on a CD-ROM or similar medium, provided however
169 that the documentation is disseminated together with the software on
170 the same medium. Any other use, such as any dissemination of printed
171 copies or use of this documentation, in whole or in part, in another
172 publication, requires the prior written consent from an authorized
173 representative of MySQL AB. MySQL AB reserves any and all rights to
174 this documentation not expressly granted above.
175
176 Please email <docs@mysql.com> for more information.
177
179 For more information, please refer to the MySQL Reference Manual, which
180 may already be installed locally and which is also available online at
181 http://dev.mysql.com/doc/.
182
184 MySQL AB (http://www.mysql.com/). This software comes with no
185 warranty.
186
187
188
189MySQL 5.0 07/04/2007 MYSQLHOTCOPY(1)