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] groups of an
39 option file. For information about option files, see Section 4.2.3.3,
40 “Using Option Files”.
41
42 · --help, -?
43
44 Display a help message and exit.
45
46 · --addtodest
47
48 Do not rename target directory (if it exists); merely add files to
49 it.
50
51 · --allowold
52
53 Do not abort if a target exists; rename it by adding an _old
54 suffix.
55
56 · --checkpoint=db_name.tbl_name
57
58 Insert checkpoint entries into the specified database db_name and
59 table tbl_name.
60
61 · --chroot=path
62
63 Base directory of the chroot jail in which mysqld operates. The
64 path value should match that of the --chroot option given to
65 mysqld.
66
67 · --debug
68
69 Enable debug output.
70
71 · --dryrun, -n
72
73 Report actions without performing them.
74
75 · --flushlog
76
77 Flush logs after all tables are locked.
78
79 · --host=host_name, -h host_name
80
81 The host name of the local host to use for making a TCP/IP
82 connection to the local server. By default, the connection is made
83 to localhost using a Unix socket file.
84
85 · --keepold
86
87 Do not delete previous (renamed) target when done.
88
89 · --method=command
90
91 The method for copying files (cp or scp). The default is cp.
92
93 · --noindices
94
95 Do not include full index files for MyISAM tables in the backup.
96 This makes the backup smaller and faster. The indexes for reloaded
97 tables can be reconstructed later with myisamchk -rq.
98
99 · --password=password, -ppassword
100
101 The password to use when connecting to the server. The password
102 value is not optional for this option, unlike for other MySQL
103 programs.
104
105 Specifying a password on the command line should be considered
106 insecure. See Section 6.1.2.1, “End-User Guidelines for Password
107 Security”. You can use an option file to avoid giving the password
108 on the command line.
109
110 · --port=port_num, -P port_num
111
112 The TCP/IP port number to use when connecting to the local server.
113
114 · --quiet, -q
115
116 Be silent except for errors.
117
118 · --record_log_pos=db_name.tbl_name
119
120 Record master and slave status in the specified database db_name
121 and table tbl_name.
122
123 · --regexp=expr
124
125 Copy all databases with names that match the given regular
126 expression.
127
128 · --resetmaster
129
130 Reset the binary log after locking all the tables.
131
132 · --resetslave
133
134 Reset the master.info file after locking all the tables.
135
136 · --socket=path, -S path
137
138 The Unix socket file to use for connections to localhost.
139
140 · --suffix=str
141
142 The suffix to use for names of copied databases.
143
144 · --tmpdir=path
145
146 The temporary directory. The default is /tmp.
147
148 · --user=user_name, -u user_name
149
150 The MySQL user name to use when connecting to the server.
151
152 Use perldoc for additional mysqlhotcopy documentation, including
153 information about the structure of the tables needed for the
154 --checkpoint and --record_log_pos options:
155
156 shell> perldoc mysqlhotcopy
157
159 Copyright © 1997, 2013, Oracle and/or its affiliates. All rights
160 reserved.
161
162 This documentation is free software; you can redistribute it and/or
163 modify it only under the terms of the GNU General Public License as
164 published by the Free Software Foundation; version 2 of the License.
165
166 This documentation is distributed in the hope that it will be useful,
167 but WITHOUT ANY WARRANTY; without even the implied warranty of
168 MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU
169 General Public License for more details.
170
171 You should have received a copy of the GNU General Public License along
172 with the program; if not, write to the Free Software Foundation, Inc.,
173 51 Franklin Street, Fifth Floor, Boston, MA 02110-1301 USA or see
174 http://www.gnu.org/licenses/.
175
176
178 For more information, please refer to the MySQL Reference Manual, which
179 may already be installed locally and which is also available online at
180 http://dev.mysql.com/doc/.
181
183 Oracle Corporation (http://dev.mysql.com/).
184
185
186
187MySQL 5.1 11/04/2013 MYSQLHOTCOPY(1)