~ubuntu-branches/ubuntu/trusty/drizzle/trusty

« back to all changes in this revision

Viewing changes to client/drizzledump.1

  • Committer: Bazaar Package Importer
  • Author(s): Monty Taylor
  • Date: 2010-10-02 14:17:48 UTC
  • mfrom: (1.1.1 upstream)
  • mto: (2.1.17 sid)
  • mto: This revision was merged to the branch mainline in revision 3.
  • Revision ID: james.westby@ubuntu.com-20101002141748-m6vbfbfjhrw1153e
Tags: 2010.09.1802-1
* New upstream release.
* Removed pid-file argument hack.
* Updated GPL-2 address to be new address.
* Directly copy in drizzledump.1 since debian doesn't have sphinx 1.0 yet.
* Link to jquery from libjs-jquery. Add it as a depend.
* Add drizzled.8 symlink to the install files.

Show diffs side-by-side

added added

removed removed

Lines of Context:
1
 
.\"     Title: \fBmysqldump\fR
2
 
.\"    Author: 
3
 
.\" Generator: DocBook XSL Stylesheets v1.70.1 <http://docbook.sf.net/>
4
 
.\"      Date: 05/23/2009
5
 
.\"    Manual: MySQL Database System
6
 
.\"    Source: MySQL 6.0
7
 
.\"
8
 
.TH "\fBMYSQLDUMP\fR" "1" "05/23/2009" "MySQL 6.0" "MySQL Database System"
9
 
.\" disable hyphenation
10
 
.nh
11
 
.\" disable justification (adjust text to left margin only)
12
 
.ad l
13
 
.SH "NAME"
14
 
mysqldump \- a database backup program
15
 
.SH "SYNOPSIS"
16
 
.HP 45
17
 
\fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB ...]]\fR
18
 
.SH "DESCRIPTION"
19
 
.PP
20
 
The
21
 
\fBmysqldump\fR
22
 
client is a backup program originally written by Igor Romanenko. It can be used to dump a database or a collection of databases for backup or transfer to another SQL server (not necessarily a MySQL server). The dump typically contains SQL statements to create the table, populate it, or both. However,
23
 
\fBmysqldump\fR
24
 
can also be used to generate files in CSV, other delimited text, or XML format.
25
 
.PP
26
 
If you are doing a backup on the server and your tables all are
27
 
MyISAM
28
 
tables, consider using the
29
 
\fBmysqlhotcopy\fR
30
 
instead because it can accomplish faster backups and faster restores. See
31
 
\fBmysqlhotcopy\fR(1).
32
 
.PP
33
 
There are three general ways to invoke
34
 
\fBmysqldump\fR:
35
 
.sp
36
 
.RS 3n
37
 
.nf
38
 
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItables\fR\fR\fB]\fR
39
 
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \fR\fB\fIdb_name3\fR\fR\fB...]\fR
40
 
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR
41
 
.fi
42
 
.RE
43
 
.PP
44
 
If you do not name any tables following
45
 
\fIdb_name\fR
46
 
or if you use the
47
 
\fB\-\-databases\fR
48
 
or
49
 
\fB\-\-all\-databases\fR
50
 
option, entire databases are dumped.
51
 
.PP
52
 
\fBmysqldump\fR
53
 
does not dump the
54
 
INFORMATION_SCHEMA
55
 
database. If you name that database explicitly on the command line,
56
 
\fBmysqldump\fR
57
 
silently ignores it.
58
 
.PP
59
 
To get a list of the options your version of
60
 
\fBmysqldump\fR
61
 
supports, execute
62
 
\fBmysqldump \-\-help\fR.
63
 
.PP
64
 
Some
65
 
\fBmysqldump\fR
66
 
options are shorthand for groups of other options.
67
 
\fB\-\-opt\fR
68
 
and
69
 
\fB\-\-compact\fR
70
 
fall into this category. For example, use of
71
 
\fB\-\-opt\fR
72
 
is the same as specifying
73
 
\fB\-\-add\-drop\-table\fR
74
 
\fB\-\-add\-locks\fR
75
 
\fB\-\-create\-options\fR
76
 
\fB\-\-disable\-keys\fR
77
 
\fB\-\-extended\-insert\fR
78
 
\fB\-\-lock\-tables\fR
79
 
\fB\-\-quick\fR
80
 
\fB\-\-set\-charset\fR. Note that all of the options that
81
 
\fB\-\-opt\fR
82
 
stands for also are on by default because
83
 
\fB\-\-opt\fR
84
 
is on by default.
85
 
.PP
86
 
To reverse the effect of a group option, uses its
87
 
\fB\-\-skip\-\fR\fB\fIxxx\fR\fR
88
 
form (\fB\-\-skip\-opt\fR
89
 
or
90
 
\fB\-\-skip\-compact\fR). It is also possible to select only part of the effect of a group option by following it with options that enable or disable specific features. Here are some examples:
91
 
.TP 3n
92
 
\(bu
93
 
To select the effect of
94
 
\fB\-\-opt\fR
95
 
except for some features, use the
96
 
\fB\-\-skip\fR
97
 
option for each feature. For example, to disable extended inserts and memory buffering, use
98
 
\fB\-\-opt\fR
99
 
\fB\-\-skip\-extended\-insert\fR
100
 
\fB\-\-skip\-quick\fR. (As of MySQL 6.0,
101
 
\fB\-\-skip\-extended\-insert\fR
102
 
\fB\-\-skip\-quick\fR
103
 
is sufficient because
104
 
\fB\-\-opt\fR
105
 
is on by default.)
106
 
.TP 3n
107
 
\(bu
108
 
To reverse
109
 
\fB\-\-opt\fR
110
 
for all features except index disabling and table locking, use
111
 
\fB\-\-skip\-opt\fR
112
 
\fB\-\-disable\-keys\fR
113
 
\fB\-\-lock\-tables\fR.
114
 
.sp
115
 
.RE
116
 
.PP
117
 
When you selectively enable or disable the effect of a group option, order is important because options are processed first to last. For example,
118
 
\fB\-\-disable\-keys\fR
119
 
\fB\-\-lock\-tables\fR
120
 
\fB\-\-skip\-opt\fR
121
 
would not have the intended effect; it is the same as
122
 
\fB\-\-skip\-opt\fR
123
 
by itself.
124
 
.PP
125
 
\fBmysqldump\fR
126
 
can retrieve and dump table contents row by row, or it can retrieve the entire content from a table and buffer it in memory before dumping it. Buffering in memory can be a problem if you are dumping large tables. To dump tables row by row, use the
127
 
\fB\-\-quick\fR
128
 
option (or
129
 
\fB\-\-opt\fR, which enables
130
 
\fB\-\-quick\fR). The
131
 
\fB\-\-opt\fR
132
 
option (and hence
133
 
\fB\-\-quick\fR) is enabled by default in MySQL 6.0; to enable memory buffering, use
134
 
\fB\-\-skip\-quick\fR.
135
 
.PP
136
 
If you are using a recent version of
137
 
\fBmysqldump\fR
138
 
to generate a dump to be reloaded into a very old MySQL server, you should not use the
139
 
\fB\-\-opt\fR
140
 
or
141
 
\fB\-\-extended\-insert\fR
142
 
option. Use
143
 
\fB\-\-skip\-opt\fR
144
 
instead.
145
 
.PP
146
 
\fBmysqldump\fR
147
 
supports the options in the following list. It also reads option files and supports the options for processing them described at
148
 
Section\ 4.2.3.2.1, \(lqCommand\-Line Options that Affect Option\-File Handling\(rq.
149
 
.TP 3n
150
 
\(bu
151
 
\fB\-\-help\fR,
152
 
\fB\-?\fR
153
 
.sp
154
 
Display a help message and exit.
155
 
.TP 3n
156
 
\(bu
157
 
\fB\-\-add\-drop\-database\fR
158
 
.sp
159
 
Add a
160
 
DROP DATABASE
161
 
statement before each
162
 
CREATE DATABASE
163
 
statement.
164
 
.TP 3n
165
 
\(bu
166
 
\fB\-\-add\-drop\-table\fR
167
 
.sp
168
 
Add a
169
 
DROP TABLE
170
 
statement before each
171
 
CREATE TABLE
172
 
statement.
173
 
.TP 3n
174
 
\(bu
175
 
\fB\-\-add\-locks\fR
176
 
.sp
177
 
Surround each table dump with
178
 
LOCK TABLES
179
 
and
180
 
UNLOCK TABLES
181
 
statements. This results in faster inserts when the dump file is reloaded. See
182
 
Section\ 7.2.25, \(lqSpeed of INSERT Statements\(rq.
183
 
.TP 3n
184
 
\(bu
185
 
\fB\-\-all\-databases\fR,
186
 
\fB\-A\fR
187
 
.sp
188
 
Dump all tables in all databases. This is the same as using the
189
 
\fB\-\-databases\fR
190
 
option and naming all the databases on the command line.
191
 
.TP 3n
192
 
\(bu
193
 
\fB\-\-allow\-keywords\fR
194
 
.sp
195
 
Allow creation of column names that are keywords. This works by prefixing each column name with the table name.
196
 
.TP 3n
197
 
\(bu
198
 
\fB\-\-apply\-slave\-statements\fR
199
 
.sp
200
 
For a slave dump produced with the
201
 
\fB\-\-dump\-slave\fR
202
 
option, add a
203
 
STOP SLAVE
204
 
statement before the
205
 
CHANGE MASTER TO
206
 
statement and a
207
 
START SLAVE
208
 
statement at the end of the output. This option was added in MySQL 6.0.4.
209
 
.TP 3n
210
 
\(bu
211
 
\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
212
 
.sp
213
 
The directory where character sets are installed. See
214
 
Section\ 9.2, \(lqThe Character Set Used for Data and Sorting\(rq.
215
 
.TP 3n
216
 
\(bu
217
 
\fB\-\-comments\fR,
218
 
\fB\-i\fR
219
 
.sp
220
 
Write additional information in the dump file such as program version, server version, and host. This option is enabled by default. To suppress this additional information, use
221
 
\fB\-\-skip\-comments\fR.
222
 
.TP 3n
223
 
\(bu
224
 
\fB\-\-compact\fR
225
 
.sp
226
 
Produce less verbose output. This option enables the
227
 
\fB\-\-skip\-add\-drop\-table\fR,
228
 
\fB\-\-skip\-add\-locks\fR,
229
 
\fB\-\-skip\-comments\fR,
230
 
\fB\-\-skip\-disable\-keys\fR, and
231
 
\fB\-\-skip\-set\-charset\fR
232
 
options.
233
 
.TP 3n
234
 
\(bu
235
 
\fB\-\-compatible=\fR\fB\fIname\fR\fR
236
 
.sp
237
 
Produce output that is more compatible with other database systems or with older MySQL servers. The value of
238
 
name
239
 
can be
240
 
ansi,
241
 
mysql323,
242
 
mysql40,
243
 
postgresql,
244
 
oracle,
245
 
mssql,
246
 
db2,
247
 
maxdb,
248
 
no_key_options,
249
 
no_table_options, or
250
 
no_field_options. To use several values, separate them by commas. These values have the same meaning as the corresponding options for setting the server SQL mode. See
251
 
Section\ 5.1.7, \(lqServer SQL Modes\(rq.
252
 
.sp
253
 
This option does not guarantee compatibility with other servers. It only enables those SQL mode values that are currently available for making dump output more compatible. For example,
254
 
\fB\-\-compatible=oracle\fR
255
 
does not map data types to Oracle types or use Oracle comment syntax.
256
 
.sp
257
 
\fIThis option requires a server version of 4.1.0 or higher\fR. With older servers, it does nothing.
258
 
.TP 3n
259
 
\(bu
260
 
\fB\-\-complete\-insert\fR,
261
 
\fB\-c\fR
262
 
.sp
263
 
Use complete
264
 
INSERT
265
 
statements that include column names.
266
 
.TP 3n
267
 
\(bu
268
 
\fB\-\-compress\fR,
269
 
\fB\-C\fR
270
 
.sp
271
 
Compress all information sent between the client and the server if both support compression.
272
 
.TP 3n
273
 
\(bu
274
 
\fB\-\-create\-options\fR
275
 
.sp
276
 
Include all MySQL\-specific table options in the
277
 
CREATE TABLE
278
 
statements.
279
 
.TP 3n
280
 
\(bu
281
 
\fB\-\-databases\fR,
282
 
\fB\-B\fR
283
 
.sp
284
 
Dump several databases. Normally,
285
 
\fBmysqldump\fR
286
 
treats the first name argument on the command line as a database name and following names as table names. With this option, it treats all name arguments as database names.
287
 
CREATE DATABASE
288
 
and
289
 
USE
290
 
statements are included in the output before each new database.
291
 
.TP 3n
292
 
\(bu
293
 
\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
294
 
\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
295
 
.sp
296
 
Write a debugging log. A typical
297
 
\fIdebug_options\fR
298
 
string is
299
 
\'d:t:o,\fIfile_name\fR'. The default value is
300
 
\'d:t:o,/tmp/mysqldump.trace'.
301
 
.TP 3n
302
 
\(bu
303
 
\fB\-\-debug\-check\fR
304
 
.sp
305
 
Print some debugging information when the program exits.
306
 
.TP 3n
307
 
\(bu
308
 
\fB\-\-debug\-info\fR
309
 
.sp
310
 
Print debugging information and memory and CPU usage statistics when the program exits.
311
 
.TP 3n
312
 
\(bu
313
 
\fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR
314
 
.sp
315
 
Use
316
 
\fIcharset_name\fR
317
 
as the default character set. See
318
 
Section\ 9.2, \(lqThe Character Set Used for Data and Sorting\(rq. If no character set is specified,
319
 
\fBmysqldump\fR
320
 
uses
321
 
utf8, and earlier versions use
322
 
latin1.
323
 
.sp
324
 
This option has no effect for output data files produced by using the
325
 
\fB\-\-tab\fR
326
 
option. See the description for that option.
327
 
.TP 3n
328
 
\(bu
329
 
\fB\-\-delayed\-insert\fR
330
 
.sp
331
 
Write
332
 
INSERT DELAYED
333
 
statements rather than
334
 
INSERT
335
 
statements.
336
 
.TP 3n
337
 
\(bu
338
 
\fB\-\-delete\-master\-logs\fR
339
 
.sp
340
 
On a master replication server, delete the binary logs after performing the dump operation. This option automatically enables
341
 
\fB\-\-master\-data\fR.
342
 
.TP 3n
343
 
\(bu
344
 
\fB\-\-disable\-keys\fR,
345
 
\fB\-K\fR
346
 
.sp
347
 
For each table, surround the
348
 
INSERT
349
 
statements with
350
 
/*!40000 ALTER TABLE \fItbl_name\fR DISABLE KEYS */;
351
 
and
352
 
/*!40000 ALTER TABLE \fItbl_name\fR ENABLE KEYS */;
353
 
statements. This makes loading the dump file faster because the indexes are created after all rows are inserted. This option is effective only for non\-unique indexes of
354
 
MyISAM
355
 
tables.
356
 
.TP 3n
357
 
\(bu
358
 
\fB\-\-dump\-date\fR
359
 
.sp
360
 
\fBmysqldump\fR
361
 
produces a
362
 
\-\- Dump completed on \fIDATE\fR
363
 
comment at the end of the dump if the
364
 
\fB\-\-comments\fR
365
 
option is given. However, the date causes dump files for identical data take at different times to appear to be different.
366
 
\fB\-\-dump\-date\fR
367
 
and
368
 
\fB\-\-skip\-dump\-date\fR
369
 
control whether the date is added to the comment. The default is
370
 
\fB\-\-dump\-date\fR
371
 
(include the date in the comment).
372
 
\fB\-\-skip\-dump\-date\fR
373
 
suppresses date printing. This option was added in MySQL 6.0.4.
374
 
.TP 3n
375
 
\(bu
376
 
\fB\-\-dump\-slave[=\fR\fB\fIvalue\fR\fR\fB]\fR
377
 
.sp
378
 
This option is similar to
379
 
\fB\-\-master\-data\fR
380
 
except that it is used to dump a replication slave server to produce a dump file that can be used to set up another server as a slave that has the same master as the dumped server. It causes the dump output to include a
381
 
CHANGE MASTER TO
382
 
statement that indicates the binary log coordinates (file name and position) of the dumped slave's master (rather than the coordinates of the dumped server, as is done by the
383
 
\fB\-\-master\-data\fR
384
 
option). These are the master server coordinates from which the slave should start replicating. This option was added in MySQL 6.0.4.
385
 
.sp
386
 
The option value is handled the same way as for
387
 
\fB\-\-master\-data\fR
388
 
and has the same effect as
389
 
\fB\-\-master\-data\fR
390
 
in terms of enabling or disabling other options and in how locking is handled.
391
 
.sp
392
 
In conjunction with
393
 
\fB\-\-dump\-slave\fR, the
394
 
\fB\-\-apply\-slave\-statements\fR
395
 
and
396
 
\fB\-\-include\-master\-host\-port\fR
397
 
options can also be used.
398
 
.TP 3n
399
 
\(bu
400
 
\fB\-\-events\fR,
401
 
\fB\-E\fR
402
 
.sp
403
 
Dump events from the dumped databases.
404
 
.TP 3n
405
 
\(bu
406
 
\fB\-\-extended\-insert\fR,
407
 
\fB\-e\fR
408
 
.sp
409
 
Use multiple\-row
410
 
INSERT
411
 
syntax that include several
412
 
VALUES
413
 
lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.
414
 
.TP 3n
415
 
\(bu
416
 
\fB\-\-fields\-terminated\-by=...\fR,
417
 
\fB\-\-fields\-enclosed\-by=...\fR,
418
 
\fB\-\-fields\-optionally\-enclosed\-by=...\fR,
419
 
\fB\-\-fields\-escaped\-by=...\fR
420
 
.sp
421
 
These options are used with the
422
 
\fB\-T\fR
423
 
option and have the same meaning as the corresponding clauses for
424
 
LOAD DATA INFILE. See
425
 
Section\ 12.2.6, \(lqLOAD DATA INFILE Syntax\(rq.
426
 
.TP 3n
427
 
\(bu
428
 
\fB\-\-first\-slave\fR,
429
 
\fB\-x\fR
430
 
.sp
431
 
Deprecated. Now renamed to
432
 
\fB\-\-lock\-all\-tables\fR.
433
 
.TP 3n
434
 
\(bu
435
 
\fB\-\-flush\-logs\fR,
436
 
\fB\-F\fR
437
 
.sp
438
 
Flush the MySQL server log files before starting the dump. This option requires the
439
 
RELOAD
440
 
privilege. Note that if you use this option in combination with the
441
 
\fB\-\-all\-databases\fR
442
 
(or
443
 
\fB\-A\fR) option, the logs are flushed
444
 
\fIfor each database dumped\fR. The exception is when using
445
 
\fB\-\-lock\-all\-tables\fR
446
 
or
447
 
\fB\-\-master\-data\fR: In this case, the logs are flushed only once, corresponding to the moment that all tables are locked. If you want your dump and the log flush to happen at exactly the same moment, you should use
448
 
\fB\-\-flush\-logs\fR
449
 
together with either
450
 
\fB\-\-lock\-all\-tables\fR
451
 
or
452
 
\fB\-\-master\-data\fR.
453
 
.TP 3n
454
 
\(bu
455
 
\fB\-\-flush\-privileges\fR
456
 
.sp
457
 
Emit a
458
 
FLUSH PRIVILEGES
459
 
statement after dumping the
460
 
mysql
461
 
database. This option should be used any time the dump contains the
462
 
mysql
463
 
database and any other database that depends on the data in the
464
 
mysql
465
 
database for proper restoration.
466
 
.TP 3n
467
 
\(bu
468
 
\fB\-\-force\fR,
469
 
\fB\-f\fR
470
 
.sp
471
 
Continue even if an SQL error occurs during a table dump.
472
 
.sp
473
 
One use for this option is to cause
474
 
\fBmysqldump\fR
475
 
to continue executing even when it encounters a view that has become invalid because the definition refers to a table that has been dropped. Without
476
 
\fB\-\-force\fR,
477
 
\fBmysqldump\fR
478
 
exits with an error message. With
479
 
\fB\-\-force\fR,
480
 
\fBmysqldump\fR
481
 
prints the error message, but it also writes an SQL comment containing the view definition to the dump output and continues executing.
482
 
.TP 3n
483
 
\(bu
484
 
\fB\-\-host=\fR\fB\fIhost_name\fR\fR,
485
 
\fB\-h \fR\fB\fIhost_name\fR\fR
486
 
.sp
487
 
Dump data from the MySQL server on the given host. The default host is
488
 
localhost.
489
 
.TP 3n
490
 
\(bu
491
 
\fB\-\-hex\-blob\fR
492
 
.sp
493
 
Dump binary columns using hexadecimal notation (for example,
494
 
\'abc'
495
 
becomes
496
 
0x616263). The affected data types are
497
 
BINARY,
498
 
VARBINARY,
499
 
BLOB, and
500
 
BIT.
501
 
.TP 3n
502
 
\(bu
503
 
\fB\-\-include\-master\-host\-port\fR
504
 
.sp
505
 
For the
506
 
CHANGE MASTER TO
507
 
statement in a slave dump produced with the
508
 
\fB\-\-dump\-slave\fR
509
 
option, add
510
 
MASTER_PORT
511
 
and
512
 
MASTER_PORT
513
 
options for the host name and TCP/IP port number of the slave's master. This option was added in MySQL 6.0.4.
514
 
.TP 3n
515
 
\(bu
516
 
\fB\-\-ignore\-table=\fR\fB\fIdb_name.tbl_name\fR\fR
517
 
.sp
518
 
Do not dump the given table, which must be specified using both the database and table names. To ignore multiple tables, use this option multiple times. This option also can be used to ignore views.
519
 
.TP 3n
520
 
\(bu
521
 
\fB\-\-insert\-ignore\fR
522
 
.sp
523
 
Write
524
 
INSERT
525
 
statements with the
526
 
IGNORE
527
 
option.
528
 
.TP 3n
529
 
\(bu
530
 
\fB\-\-lines\-terminated\-by=...\fR
531
 
.sp
532
 
This option is used with the
533
 
\fB\-T\fR
534
 
option and has the same meaning as the corresponding clause for
535
 
LOAD DATA INFILE. See
536
 
Section\ 12.2.6, \(lqLOAD DATA INFILE Syntax\(rq.
537
 
.TP 3n
538
 
\(bu
539
 
\fB\-\-lock\-all\-tables\fR,
540
 
\fB\-x\fR
541
 
.sp
542
 
Lock all tables across all databases. This is achieved by acquiring a global read lock for the duration of the whole dump. This option automatically turns off
543
 
\fB\-\-single\-transaction\fR
544
 
and
545
 
\fB\-\-lock\-tables\fR.
546
 
.TP 3n
547
 
\(bu
548
 
\fB\-\-lock\-tables\fR,
549
 
\fB\-l\fR
550
 
.sp
551
 
Lock all tables before dumping them. The tables are locked with
552
 
READ LOCAL
553
 
to allow concurrent inserts in the case of
554
 
MyISAM
555
 
tables. For transactional tables such as
556
 
InnoDB
557
 
and
558
 
BDB,
559
 
\fB\-\-single\-transaction\fR
560
 
is a much better option, because it does not need to lock the tables at all.
561
 
.sp
562
 
Please note that when dumping multiple databases,
563
 
\fB\-\-lock\-tables\fR
564
 
locks tables for each database separately. Therefore, this option does not guarantee that the tables in the dump file are logically consistent between databases. Tables in different databases may be dumped in completely different states.
565
 
.TP 3n
566
 
\(bu
567
 
\fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR
568
 
.sp
569
 
Append warnings and errors to the named file.
570
 
.TP 3n
571
 
\(bu
572
 
\fB\-\-master\-data[=\fR\fB\fIvalue\fR\fR\fB]\fR
573
 
.sp
574
 
Use this option to dump a master replication server to produce a dump file that can be used to set up another server as a slave of the master. It causes the dump output to include a
575
 
CHANGE MASTER TO
576
 
statement that indicates the binary log coordinates (file name and position) of the dumped server. These are the master server coordinates from which the slave should start replicating.
577
 
.sp
578
 
If the option value is 2, the
579
 
CHANGE MASTER TO
580
 
statement is written as an SQL comment, and thus is informative only; it has no effect when the dump file is reloaded. If the option value is 1, the statement takes effect when the dump file is reloaded. If the option value is not specified, the default value is 1.
581
 
.sp
582
 
This option requires the
583
 
RELOAD
584
 
privilege and the binary log must be enabled.
585
 
.sp
586
 
The
587
 
\fB\-\-master\-data\fR
588
 
option automatically turns off
589
 
\fB\-\-lock\-tables\fR. It also turns on
590
 
\fB\-\-lock\-all\-tables\fR, unless
591
 
\fB\-\-single\-transaction\fR
592
 
also is specified, in which case, a global read lock is acquired only for a short time at the beginning of the dump (see the description for
593
 
\fB\-\-single\-transaction\fR). In all cases, any action on logs happens at the exact moment of the dump.
594
 
.sp
595
 
It is also possible to set up a slave by dumping an existing slave of the master. To do this, use the
596
 
\fB\-\-dump\-slave\fR
597
 
option instead.
598
 
.TP 3n
599
 
\(bu
600
 
\fB\-\-no\-autocommit\fR
601
 
.sp
602
 
Enclose the
603
 
INSERT
604
 
statements for each dumped table within
605
 
SET autocommit = 0
606
 
and
607
 
COMMIT
608
 
statements.
609
 
.TP 3n
610
 
\(bu
611
 
\fB\-\-no\-create\-db\fR,
612
 
\fB\-n\fR
613
 
.sp
614
 
This option suppresses the
615
 
CREATE DATABASE
616
 
statements that are otherwise included in the output if the
617
 
\fB\-\-databases\fR
618
 
or
619
 
\fB\-\-all\-databases\fR
620
 
option is given.
621
 
.TP 3n
622
 
\(bu
623
 
\fB\-\-no\-create\-info\fR,
624
 
\fB\-t\fR
625
 
.sp
626
 
Do not write
627
 
CREATE TABLE
628
 
statements that re\-create each dumped table.
629
 
.TP 3n
630
 
\(bu
631
 
\fB\-\-no\-data\fR,
632
 
\fB\-d\fR
633
 
.sp
634
 
Do not write any table row information (that is, do not dump table contents). This is very useful if you want to dump only the
635
 
CREATE TABLE
636
 
statement for the table.
637
 
.TP 3n
638
 
\(bu
639
 
\fB\-\-no\-set\-names\fR
640
 
.sp
641
 
This option is deprecated. Use
642
 
\fB\-\-skip\-set\-charset\fR. instead.
643
 
.TP 3n
644
 
\(bu
645
 
\fB\-\-opt\fR
646
 
.sp
647
 
This option is shorthand; it is the same as specifying
648
 
\fB\-\-add\-drop\-table\fR
649
 
\fB\-\-add\-locks\fR
650
 
\fB\-\-create\-options\fR
651
 
\fB\-\-disable\-keys\fR
652
 
\fB\-\-extended\-insert\fR
653
 
\fB\-\-lock\-tables\fR
654
 
\fB\-\-quick\fR
655
 
\fB\-\-set\-charset\fR. It should give you a fast dump operation and produce a dump file that can be reloaded into a MySQL server quickly.
656
 
.sp
657
 
\fIThe \fR\fI\fB\-\-opt\fR\fR\fI option is enabled by default. Use \fR\fI\fB\-\-skip\-opt\fR\fR\fI to disable it.\fR
658
 
See the discussion at the beginning of this section for information about selectively enabling or disabling certain of the options affected by
659
 
\fB\-\-opt\fR.
660
 
.TP 3n
661
 
\(bu
662
 
\fB\-\-order\-by\-primary\fR
663
 
.sp
664
 
Sorts each table's rows by its primary key, or by its first unique index, if such an index exists. This is useful when dumping a
665
 
MyISAM
666
 
table to be loaded into an
667
 
InnoDB
668
 
table, but will make the dump itself take considerably longer.
669
 
.TP 3n
670
 
\(bu
671
 
\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR,
672
 
\fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR
673
 
.sp
674
 
The password to use when connecting to the server. If you use the short option form (\fB\-p\fR), you
675
 
\fIcannot\fR
676
 
have a space between the option and the password. If you omit the
677
 
\fIpassword\fR
678
 
value following the
679
 
\fB\-\-password\fR
680
 
or
681
 
\fB\-p\fR
682
 
option on the command line, you are prompted for one.
683
 
.sp
684
 
Specifying a password on the command line should be considered insecure. See
685
 
Section\ 5.5.6.2, \(lqEnd\-User Guidelines for Password Security\(rq.
686
 
.TP 3n
687
 
\(bu
688
 
\fB\-\-pipe\fR,
689
 
\fB\-W\fR
690
 
.sp
691
 
On Windows, connect to the server via a named pipe. This option applies only for connections to a local server, and only if the server supports named\-pipe connections.
692
 
.TP 3n
693
 
\(bu
694
 
\fB\-\-port=\fR\fB\fIport_num\fR\fR,
695
 
\fB\-P \fR\fB\fIport_num\fR\fR
696
 
.sp
697
 
The TCP/IP port number to use for the connection.
698
 
.TP 3n
699
 
\(bu
700
 
\fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR
701
 
.sp
702
 
The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally would cause a protocol to be used other than the one you want. For details on the allowable values, see
703
 
Section\ 4.2.2, \(lqConnecting to the MySQL Server\(rq.
704
 
.TP 3n
705
 
\(bu
706
 
\fB\-\-quick\fR,
707
 
\fB\-q\fR
708
 
.sp
709
 
This option is useful for dumping large tables. It forces
710
 
\fBmysqldump\fR
711
 
to retrieve rows for a table from the server a row at a time rather than retrieving the entire row set and buffering it in memory before writing it out.
712
 
.TP 3n
713
 
\(bu
714
 
\fB\-\-quote\-names\fR,
715
 
\fB\-Q\fR
716
 
.sp
717
 
Quote database, table, and column names within
718
 
\(lq`\(rq
719
 
characters. If the
720
 
ANSI_QUOTES
721
 
SQL mode is enabled, names are quoted within
722
 
\(lq"\(rq
723
 
characters. This option is enabled by default. It can be disabled with
724
 
\fB\-\-skip\-quote\-names\fR, but this option should be given after any option such as
725
 
\fB\-\-compatible\fR
726
 
that may enable
727
 
\fB\-\-quote\-names\fR.
728
 
.TP 3n
729
 
\(bu
730
 
\fB\-\-replace\fR
731
 
.sp
732
 
Write
733
 
REPLACE
734
 
statements rather than
735
 
INSERT
736
 
statements.
737
 
.TP 3n
738
 
\(bu
739
 
\fB\-\-result\-file=\fR\fB\fIfile_name\fR\fR,
740
 
\fB\-r \fR\fB\fIfile_name\fR\fR
741
 
.sp
742
 
Direct output to a given file. This option should be used on Windows to prevent newline
743
 
\(lq\\n\(rq
744
 
characters from being converted to
745
 
\(lq\\r\\n\(rq
746
 
carriage return/newline sequences. The result file is created and its contents overwritten, even if an error occurs while generating the dump. The previous contents are lost.
747
 
.TP 3n
748
 
\(bu
749
 
\fB\-\-routines\fR,
750
 
\fB\-R\fR
751
 
.sp
752
 
Dump stored routines (procedures and functions) from the dumped databases. Use of this option requires the
753
 
SELECT
754
 
privilege for the
755
 
mysql.proc
756
 
table. The output generated by using
757
 
\fB\-\-routines\fR
758
 
contains
759
 
CREATE PROCEDURE
760
 
and
761
 
CREATE FUNCTION
762
 
statements to re\-create the routines. However, these statements do not include attributes such as the routine creation and modification timestamps. This means that when the routines are reloaded, they will be created with the timestamps equal to the reload time.
763
 
.sp
764
 
If you require routines to be re\-created with their original timestamp attributes, do not use
765
 
\fB\-\-routines\fR. Instead, dump and reload the contents of the
766
 
mysql.proc
767
 
table directly, using a MySQL account that has appropriate privileges for the
768
 
mysql
769
 
database.
770
 
.TP 3n
771
 
\(bu
772
 
\fB\-\-set\-charset\fR
773
 
.sp
774
 
Add
775
 
SET NAMES \fIdefault_character_set\fR
776
 
to the output. This option is enabled by default. To suppress the
777
 
SET NAMES
778
 
statement, use
779
 
\fB\-\-skip\-set\-charset\fR.
780
 
.TP 3n
781
 
\(bu
782
 
\fB\-\-single\-transaction\fR
783
 
.sp
784
 
This option issues a
785
 
BEGIN
786
 
SQL statement before dumping data from the server. It is useful only with transactional tables such as
787
 
InnoDB, because then it dumps the consistent state of the database at the time when
788
 
BEGIN
789
 
was issued without blocking any applications.
790
 
.sp
791
 
When using this option, you should keep in mind that only
792
 
InnoDB
793
 
and
794
 
Falcon
795
 
tables are dumped in a consistent state. For example, any
796
 
MyISAM
797
 
or
798
 
MEMORY
799
 
tables dumped while using this option may still change state.
800
 
.sp
801
 
While a
802
 
\fB\-\-single\-transaction\fR
803
 
dump is in process, to ensure a valid dump file (correct table contents and binary log position), no other connection should use the following statements:
804
 
ALTER TABLE,
805
 
DROP TABLE,
806
 
RENAME TABLE,
807
 
TRUNCATE TABLE. A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause the
808
 
SELECT
809
 
performed by
810
 
\fBmysqldump\fR
811
 
to retrieve the table contents to obtain incorrect contents or fail.
812
 
.sp
813
 
The
814
 
\fB\-\-single\-transaction\fR
815
 
option and the
816
 
\fB\-\-lock\-tables\fR
817
 
option are mutually exclusive, because
818
 
LOCK TABLES
819
 
causes any pending transactions to be committed implicitly.
820
 
.sp
821
 
To dump large tables, you should combine this option with
822
 
\fB\-\-quick\fR.
823
 
.TP 3n
824
 
\(bu
825
 
\fB\-\-skip\-comments\fR
826
 
.sp
827
 
See the description for the
828
 
\fB\-\-comments\fR
829
 
option.
830
 
.TP 3n
831
 
\(bu
832
 
\fB\-\-skip\-opt\fR
833
 
.sp
834
 
See the description for the
835
 
\fB\-\-opt\fR
836
 
option.
837
 
.TP 3n
838
 
\(bu
839
 
\fB\-\-socket=\fR\fB\fIpath\fR\fR,
840
 
\fB\-S \fR\fB\fIpath\fR\fR
841
 
.sp
842
 
For connections to
843
 
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.
844
 
.TP 3n
845
 
\(bu
846
 
\fB\-\-ssl*\fR
847
 
.sp
848
 
Options that begin with
849
 
\fB\-\-ssl\fR
850
 
specify whether to connect to the server via SSL and indicate where to find SSL keys and certificates. See
851
 
Section\ 5.5.7.3, \(lqSSL Command Options\(rq.
852
 
.TP 3n
853
 
\(bu
854
 
\fB\-\-tab=\fR\fB\fIpath\fR\fR,
855
 
\fB\-T \fR\fB\fIpath\fR\fR
856
 
.sp
857
 
Produce tab\-separated data files. For each dumped table,
858
 
\fBmysqldump\fR
859
 
creates a
860
 
\fI\fItbl_name\fR\fR\fI.sql\fR
861
 
file that contains the
862
 
CREATE TABLE
863
 
statement that creates the table, and a
864
 
\fI\fItbl_name\fR\fR\fI.txt\fR
865
 
file that contains its data. The option value is the directory in which to write the files.
866
 
.sp
867
 
By default, the
868
 
\fI.txt\fR
869
 
data files are formatted using tab characters between column values and a newline at the end of each line. The format can be specified explicitly using the
870
 
\fB\-\-fields\-\fR\fB\fIxxx\fR\fR
871
 
and
872
 
\fB\-\-lines\-terminated\-by\fR
873
 
options.
874
 
.sp
875
 
Column values are dumped using the
876
 
binary
877
 
character set and the
878
 
\fB\-\-default\-character\-set\fR
879
 
option is ignored. In effect, there is no character set conversion. If a table contains columns in several character sets, the output data file will as well and you may not be able to reload the file correctly.
880
 
.sp
881
 
.it 1 an-trap
882
 
.nr an-no-space-flag 1
883
 
.nr an-break-flag 1
884
 
.br
885
 
\fBNote\fR
886
 
This option should be used only when
887
 
\fBmysqldump\fR
888
 
is run on the same machine as the
889
 
\fBmysqld\fR
890
 
server. You must have the
891
 
FILE
892
 
privilege, and the server must have permission to write files in the directory that you specify.
893
 
.TP 3n
894
 
\(bu
895
 
\fB\-\-tables\fR
896
 
.sp
897
 
Override the
898
 
\fB\-\-databases\fR
899
 
or
900
 
\fB\-B\fR
901
 
option.
902
 
\fBmysqldump\fR
903
 
regards all name arguments following the option as table names.
904
 
.TP 3n
905
 
\(bu
906
 
\fB\-\-triggers\fR
907
 
.sp
908
 
Dump triggers for each dumped table. This option is enabled by default; disable it with
909
 
\fB\-\-skip\-triggers\fR.
910
 
.TP 3n
911
 
\(bu
912
 
\fB\-\-tz\-utc\fR
913
 
.sp
914
 
This option enables
915
 
TIMESTAMP
916
 
columns to be dumped and reloaded between servers in different time zones.
917
 
\fBmysqldump\fR
918
 
sets its connection time zone to UTC and adds
919
 
SET TIME_ZONE='+00:00'
920
 
to the dump file. Without this option,
921
 
TIMESTAMP
922
 
columns are dumped and reloaded in the time zones local to the source and destination servers, which can cause the values to change.
923
 
\fB\-\-tz\-utc\fR
924
 
also protects against changes due to daylight saving time.
925
 
\fB\-\-tz\-utc\fR
926
 
is enabled by default. To disable it, use
927
 
\fB\-\-skip\-tz\-utc\fR.
928
 
.TP 3n
929
 
\(bu
930
 
\fB\-\-user=\fR\fB\fIuser_name\fR\fR,
931
 
\fB\-u \fR\fB\fIuser_name\fR\fR
932
 
.sp
933
 
The MySQL user name to use when connecting to the server.
934
 
.TP 3n
935
 
\(bu
936
 
\fB\-\-verbose\fR,
937
 
\fB\-v\fR
938
 
.sp
939
 
Verbose mode. Print more information about what the program does.
940
 
.TP 3n
941
 
\(bu
942
 
\fB\-\-version\fR,
943
 
\fB\-V\fR
944
 
.sp
945
 
Display version information and exit.
946
 
.TP 3n
947
 
\(bu
948
 
\fB\-\-where='\fR\fB\fIwhere_condition\fR\fR\fB'\fR,
949
 
\fB\-w '\fR\fB\fIwhere_condition\fR\fR\fB'\fR
950
 
.sp
951
 
Dump only rows selected by the given
952
 
WHERE
953
 
condition. Quotes around the condition are mandatory if it contains spaces or other characters that are special to your command interpreter.
954
 
.sp
955
 
Examples:
956
 
.sp
957
 
.RS 3n
958
 
.nf
959
 
\-\-where="user='jimf'"
960
 
\-w"userid>1"
961
 
\-w"userid<1"
962
 
.fi
963
 
.RE
964
 
.TP 3n
965
 
\(bu
966
 
\fB\-\-xml\fR,
967
 
\fB\-X\fR
968
 
.sp
969
 
Write dump output as well\-formed XML.
970
 
.sp
971
 
\fBNULL\fR\fB, \fR\fB'NULL'\fR\fB, and Empty Values\fR: For some column named
972
 
\fIcolumn_name\fR, the
973
 
NULL
974
 
value, an empty string, and the string value
975
 
\'NULL'
976
 
are distinguished from one another in the output generated by this option as follows.
977
 
.TS
978
 
allbox tab(:);
979
 
l l
980
 
l l
981
 
l l
982
 
l l.
983
 
T{
984
 
\fBValue\fR:
985
 
T}:T{
986
 
\fBXML Representation\fR:
987
 
T}
988
 
T{
989
 
NULL (\fIunknown value\fR)
990
 
T}:T{
991
 
<field name="\fIcolumn_name\fR"
992
 
       xsi:nil="true" />
993
 
T}
994
 
T{
995
 
\'' (\fIempty string\fR)
996
 
T}:T{
997
 
<field name="\fIcolumn_name\fR">
998
 
</field>
999
 
T}
1000
 
T{
1001
 
\'NULL' (\fIstring value\fR)
1002
 
T}:T{
1003
 
<field name="\fIcolumn_name\fR">
1004
 
NULL
1005
 
</field>
1006
 
T}
1007
 
.TE
1008
 
.sp
1009
 
The output from the
1010
 
\fBmysql\fR
1011
 
client when run using the
1012
 
\fB\-\-xml\fR
1013
 
option also follows these rules. (See
1014
 
the section called \(lq\fBMYSQL\fR OPTIONS\(rq.)
1015
 
.sp
1016
 
XML output from
1017
 
\fBmysqldump\fR
1018
 
includes the XML namespace, as shown here:
1019
 
.sp
1020
 
.RS 3n
1021
 
.nf
1022
 
shell> \fBmysqldump \-\-xml \-u root world City\fR
1023
 
<?xml version="1.0"?>
1024
 
<mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema\-instance">
1025
 
<database name="world">
1026
 
<table_structure name="City">
1027
 
<field Field="ID" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" />
1028
 
<field Field="Name" Type="char(35)" Null="NO" Key="" Default="" Extra="" />
1029
 
<field Field="CountryCode" Type="char(3)" Null="NO" Key="" Default="" Extra="" />
1030
 
<field Field="District" Type="char(20)" Null="NO" Key="" Default="" Extra="" />
1031
 
<field Field="Population" Type="int(11)" Null="NO" Key="" Default="0" Extra="" />
1032
 
<key Table="City" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="ID" Collation="A" Cardinality="4079"
1033
 
Null="" Index_type="BTREE" Comment="" />
1034
 
<options Name="City" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="4079" Avg_row_length="67" Data_length="27329
1035
 
3" Max_data_length="18858823439613951" Index_length="43008" Data_free="0" Auto_increment="4080" Create_time="2007\-03\-31 01:47:01" Updat
1036
 
e_time="2007\-03\-31 01:47:02" Collation="latin1_swedish_ci" Create_options="" Comment="" />
1037
 
</table_structure>
1038
 
<table_data name="City">
1039
 
<row>
1040
 
<field name="ID">1</field>
1041
 
<field name="Name">Kabul</field>
1042
 
<field name="CountryCode">AFG</field>
1043
 
<field name="District">Kabol</field>
1044
 
<field name="Population">1780000</field>
1045
 
</row>
1046
 
\fI...\fR
1047
 
<row>
1048
 
<field name="ID">4079</field>
1049
 
<field name="Name">Rafah</field>
1050
 
<field name="CountryCode">PSE</field>
1051
 
<field name="District">Rafah</field>
1052
 
<field name="Population">92020</field>
1053
 
</row>
1054
 
</table_data>
1055
 
</database>
1056
 
</mysqldump>
1057
 
.fi
1058
 
.RE
1059
 
.sp
1060
 
.sp
1061
 
.RE
1062
 
.PP
1063
 
You can also set the following variables by using
1064
 
\fB\-\-\fR\fB\fIvar_name\fR\fR\fB=\fR\fB\fIvalue\fR\fR
1065
 
syntax:
1066
 
.TP 3n
1067
 
\(bu
1068
 
max_allowed_packet
1069
 
.sp
1070
 
The maximum size of the buffer for client/server communication. The maximum is 1GB.
1071
 
.TP 3n
1072
 
\(bu
1073
 
net_buffer_length
1074
 
.sp
1075
 
The initial size of the buffer for client/server communication. When creating multiple\-row\-insert statements (as with option
1076
 
\fB\-\-extended\-insert\fR
1077
 
or
1078
 
\fB\-\-opt\fR),
1079
 
\fBmysqldump\fR
1080
 
creates rows up to
1081
 
net_buffer_length
1082
 
length. If you increase this variable, you should also ensure that the
1083
 
net_buffer_length
1084
 
variable in the MySQL server is at least this large.
1085
 
.sp
1086
 
.RE
1087
 
.PP
1088
 
The most common use of
1089
 
\fBmysqldump\fR
1090
 
is probably for making a backup of an entire database:
1091
 
.sp
1092
 
.RS 3n
1093
 
.nf
1094
 
shell> \fBmysqldump \fR\fB\fIdb_name\fR\fR\fB > \fR\fB\fIbackup\-file.sql\fR\fR
1095
 
.fi
1096
 
.RE
1097
 
.PP
1098
 
You can read the dump file back into the server like this:
1099
 
.sp
1100
 
.RS 3n
1101
 
.nf
1102
 
shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIbackup\-file.sql\fR\fR
1103
 
.fi
1104
 
.RE
1105
 
.PP
1106
 
Or like this:
1107
 
.sp
1108
 
.RS 3n
1109
 
.nf
1110
 
shell> \fBmysql \-e "source \fR\fB\fI/path\-to\-backup/backup\-file.sql\fR\fR\fB" \fR\fB\fIdb_name\fR\fR
1111
 
.fi
1112
 
.RE
1113
 
.PP
1114
 
\fBmysqldump\fR
1115
 
is also very useful for populating databases by copying data from one MySQL server to another:
1116
 
.sp
1117
 
.RS 3n
1118
 
.nf
1119
 
shell> \fBmysqldump \-\-opt \fR\fB\fIdb_name\fR\fR\fB | mysql \-\-host=\fR\fB\fIremote_host\fR\fR\fB \-C \fR\fB\fIdb_name\fR\fR
1120
 
.fi
1121
 
.RE
1122
 
.PP
1123
 
It is possible to dump several databases with one command:
1124
 
.sp
1125
 
.RS 3n
1126
 
.nf
1127
 
shell> \fBmysqldump \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB ...] > my_databases.sql\fR
1128
 
.fi
1129
 
.RE
1130
 
.PP
1131
 
To dump all databases, use the
1132
 
\fB\-\-all\-databases\fR
1133
 
option:
1134
 
.sp
1135
 
.RS 3n
1136
 
.nf
1137
 
shell> \fBmysqldump \-\-all\-databases > all_databases.sql\fR
1138
 
.fi
1139
 
.RE
1140
 
.PP
1141
 
For
1142
 
InnoDB
1143
 
tables,
1144
 
\fBmysqldump\fR
1145
 
provides a way of making an online backup:
1146
 
.sp
1147
 
.RS 3n
1148
 
.nf
1149
 
shell> \fBmysqldump \-\-all\-databases \-\-single\-transaction > all_databases.sql\fR
1150
 
.fi
1151
 
.RE
1152
 
.PP
1153
 
This backup acquires a global read lock on all tables (using
1154
 
FLUSH TABLES WITH READ LOCK) at the beginning of the dump. As soon as this lock has been acquired, the binary log coordinates are read and the lock is released. If long updating statements are running when the
1155
 
FLUSH
1156
 
statement is issued, the MySQL server may get stalled until those statements finish. After that, the dump becomes lock\-free and does not disturb reads and writes on the tables. If the update statements that the MySQL server receives are short (in terms of execution time), the initial lock period should not be noticeable, even with many updates.
1157
 
.PP
1158
 
For point\-in\-time recovery (also known as
1159
 
\(lqroll\-forward,\(rq
1160
 
when you need to restore an old backup and replay the changes that happened since that backup), it is often useful to rotate the binary log (see
1161
 
Section\ 5.2.4, \(lqThe Binary Log\(rq) or at least know the binary log coordinates to which the dump corresponds:
1162
 
.sp
1163
 
.RS 3n
1164
 
.nf
1165
 
shell> \fBmysqldump \-\-all\-databases \-\-master\-data=2 > all_databases.sql\fR
1166
 
.fi
1167
 
.RE
1168
 
.PP
1169
 
Or:
1170
 
.sp
1171
 
.RS 3n
1172
 
.nf
1173
 
shell> \fBmysqldump \-\-all\-databases \-\-flush\-logs \-\-master\-data=2\fR
1174
 
              \fB> all_databases.sql\fR
1175
 
.fi
1176
 
.RE
1177
 
.PP
1178
 
The
1179
 
\fB\-\-master\-data\fR
1180
 
and
1181
 
\fB\-\-single\-transaction\fR
1182
 
options can be used simultaneously, which provides a convenient way to make an online backup suitable for point\-in\-time recovery if tables are stored using the
1183
 
InnoDB
1184
 
storage engine.
1185
 
.PP
1186
 
For more information on making backups, see
1187
 
Section\ 6.1, \(lqDatabase Backups\(rq, and
1188
 
Section\ 6.2, \(lqExample Backup and Recovery Strategy\(rq.
1189
 
.PP
1190
 
If you encounter problems backing up views, please read the section that covers restrictions on views which describes a workaround for backing up views when this fails due to insufficient privileges. See
1191
 
Section\ D.5, \(lqRestrictions on Views\(rq.
1192
 
.SH "COPYRIGHT"
1193
 
.PP
1194
 
Copyright 2007\-2008 MySQL AB, 2009 Sun Microsystems, Inc.
1195
 
.PP
1196
 
This documentation is free software; you can redistribute it and/or modify it only under the terms of the GNU General Public License as published by the Free Software Foundation; version 2 of the License.
1197
 
.PP
1198
 
This documentation is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details.
1199
 
.PP
1200
 
You should have received a copy of the GNU General Public License along with the program; if not, write to the Free Software Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA 02110\-1301 USA or see http://www.gnu.org/licenses/.
1201
 
.SH "SEE ALSO"
1202
 
For more information, please refer to the MySQL Reference Manual,
1203
 
which may already be installed locally and which is also available
1204
 
online at http://dev.mysql.com/doc/.
1205
 
.SH AUTHOR
1206
 
Sun Microsystems, Inc. (http://www.mysql.com/).