1MYSQLHOTCOPY(1) MySQL Database System MYSQLHOTCOPY(1)
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 FLUSH TABLES, LOCK TABLES, and cp or
14 scp to make a database backup. It is a fast way to make a backup of the
15 database or single tables, but it can be run only on the same machine
16 where the database directories are located. mysqlhotcopy works only
17 for backing up MyISAM and ARCHIVE tables. It runs on Unix and NetWare.
18
19 To use mysqlhotcopy, you must have read access to the files for the
20 tables that you are backing up, the SELECT privilege for those tables,
21 the RELOAD privilege (to be able to execute FLUSH TABLES), and the LOCK
22 TABLES privilege (to be able to lock the tables).
23
24 shell> mysqlhotcopy db_name [/path/to/new_directory]
25
26 shell> mysqlhotcopy db_name_1 ... db_name_n /path/to/new_directory
27
28 Back up tables in the given database that match a regular expression:
29
30 shell> mysqlhotcopy db_name./regex/
31
32 The regular expression for the table name can be negated by prefixing
33 it with a tilde (“~”):
34
35 shell> mysqlhotcopy db_name./~regex/
36
37 mysqlhotcopy supports the following options, which can be specified on
38 the command line or in the [mysqlhotcopy] and [client] option file
39 groups.
40
41 · --help, -?
42
43 Display a help message and exit.
44
45 · --addtodest
46
47 Do not rename target directory (if it exists); merely add files to
48 it.
49
50 · --allowold
51
52 Do not abort if a target exists; rename it by adding an _old
53 suffix.
54
55 · --checkpoint=db_name.tbl_name
56
57 Insert checkpoint entries into the specified database db_name and
58 table tbl_name.
59
60 · --chroot=path
61
62 Base directory of the chroot jail in which mysqld operates. The
63 path value should match that of the --chroot option given to
64 mysqld.
65
66 · --debug
67
68 Enable debug output.
69
70 · --dryrun, -n
71
72 Report actions without performing them.
73
74 · --flushlog
75
76 Flush logs after all tables are locked.
77
78 · --host=host_name, -h host_name
79
80 The host name of the local host to use for making a TCP/IP
81 connection to the local server. By default, the connection is made
82 to localhost using a Unix socket file.
83
84 · --keepold
85
86 Do not delete previous (renamed) target when done.
87
88 · --method=command
89
90 The method for copying files (cp or scp). The default is cp.
91
92 · --noindices
93
94 Do not include full index files for MyISAM tables in the backup.
95 This makes the backup smaller and faster. The indexes for reloaded
96 tables can be reconstructed later with myisamchk -rq.
97
98 · --password=password, -ppassword
99
100 The password to use when connecting to the server. The password
101 value is not optional for this option, unlike for other MySQL
102 programs.
103
104 Specifying a password on the command line should be considered
105 insecure. See Section 5.3.2.2, “End-User Guidelines for Password
106 Security”. You can use an option file to avoid giving the password
107 on the command line.
108
109 · --port=port_num, -P port_num
110
111 The TCP/IP port number to use when connecting to the local server.
112
113 · --quiet, -q
114
115 Be silent except for errors.
116
117 · --record_log_pos=db_name.tbl_name
118
119 Record master and slave status in the specified database db_name
120 and table tbl_name.
121
122 · --regexp=expr
123
124 Copy all databases with names that match the given regular
125 expression.
126
127 · --resetmaster
128
129 Reset the binary log after locking all the tables.
130
131 · --resetslave
132
133 Reset the master.info file after locking all the tables.
134
135 · --socket=path, -S path
136
137 The Unix socket file to use for connections to localhost.
138
139 · --suffix=str
140
141 The suffix to use for names of copied databases.
142
143 · --tmpdir=path
144
145 The temporary directory. The default is /tmp.
146
147 · --user=user_name, -u user_name
148
149 The MySQL user name to use when connecting to the server.
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 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
159
160 This documentation is free software; you can redistribute it and/or
161 modify it only under the terms of the GNU General Public License as
162 published by the Free Software Foundation; version 2 of the License.
163
164 This documentation is distributed in the hope that it will be useful,
165 but WITHOUT ANY WARRANTY; without even the implied warranty of
166 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
167 General Public License for more details.
168
169 You should have received a copy of the GNU General Public License along
170 with the program; if not, write to the Free Software Foundation, Inc.,
171 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
172 http://www.gnu.org/licenses/.
173
174
176 For more information, please refer to the MySQL Reference Manual, which
177 may already be installed locally and which is also available online at
178 http://dev.mysql.com/doc/.
179
181 Sun Microsystems, Inc. (http://www.mysql.com/).
182
183
184
185MySQL 5.1 04/06/2010 MYSQLHOTCOPY(1)