~ubuntu-branches/ubuntu/utopic/mariadb-5.5/utopic-proposed

« back to all changes in this revision

Viewing changes to .pc/90_spelling.diff/man/mysqldump.1

  • Committer: Package Import Robot
  • Author(s): Otto Kekäläinen
  • Date: 2014-08-27 21:12:36 UTC
  • mfrom: (2.1.6 sid)
  • Revision ID: package-import@ubuntu.com-20140827211236-se41hwfe4xy0hpef
Tags: 5.5.39-2
* d/control: Removed Provides: libmysqlclient-dev (Closes: #759309)
* d/control: Removed Provides: libmysqld-dev with same motivation
* Re-introduced tha HPPA build patch as the upstream fix wasn't complete
* Fixed all kFreeBSD build and test suite issues
* Added Italian translation (Closes: #759813)

Show diffs side-by-side

added added

removed removed

Lines of Context:
 
1
'\" t
 
2
.\"     Title: \fBmysqldump\fR
 
3
.\"    Author: [FIXME: author] [see http://docbook.sf.net/el/author]
 
4
.\" Generator: DocBook XSL Stylesheets v1.75.2 <http://docbook.sf.net/>
 
5
.\"      Date: 04/06/2010
 
6
.\"    Manual: MySQL Database System
 
7
.\"    Source: MySQL 5.1
 
8
.\"  Language: English
 
9
.\"
 
10
.TH "\FBMYSQLDUMP\FR" "1" "04/06/2010" "MySQL 5\&.1" "MySQL Database System"
 
11
.\" -----------------------------------------------------------------
 
12
.\" * set default formatting
 
13
.\" -----------------------------------------------------------------
 
14
.\" disable hyphenation
 
15
.nh
 
16
.\" disable justification (adjust text to left margin only)
 
17
.ad l
 
18
.\" -----------------------------------------------------------------
 
19
.\" * MAIN CONTENT STARTS HERE *
 
20
.\" -----------------------------------------------------------------
 
21
.\" mysqldump
 
22
.\" dumping: databases and tables
 
23
.\" backups: databases and tables
 
24
.\" databases: dumping
 
25
.\" tables: dumping
 
26
.SH "NAME"
 
27
mysqldump \- a database backup program
 
28
.SH "SYNOPSIS"
 
29
.HP \w'\fBmysqldump\ [\fR\fB\fIoptions\fR\fR\fB]\ [\fR\fB\fIdb_name\fR\fR\fB\ [\fR\fB\fItbl_name\fR\fR\fB\ \&.\&.\&.]]\fR\ 'u
 
30
\fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] [\fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]]\fR
 
31
.SH "DESCRIPTION"
 
32
.PP
 
33
The
 
34
\fBmysqldump\fR
 
35
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,
 
36
\fBmysqldump\fR
 
37
can also be used to generate files in CSV, other delimited text, or XML format\&.
 
38
.PP
 
39
If you are doing a backup on the server and your tables all are
 
40
MyISAM
 
41
tables, consider using the
 
42
\fBmysqlhotcopy\fR
 
43
instead because it can accomplish faster backups and faster restores\&. See
 
44
\fBmysqlhotcopy\fR(1)\&.
 
45
.PP
 
46
There are three general ways to invoke
 
47
\fBmysqldump\fR:
 
48
.sp
 
49
.if n \{\
 
50
.RS 4
 
51
.\}
 
52
.nf
 
53
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \fR\fB\fIdb_name\fR\fR\fB [\fR\fB\fItbl_name\fR\fR\fB \&.\&.\&.]\fR
 
54
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-databases \fR\fB\fIdb_name\fR\fR\fB \&.\&.\&.\fR
 
55
shell> \fBmysqldump [\fR\fB\fIoptions\fR\fR\fB] \-\-all\-databases\fR
 
56
.fi
 
57
.if n \{\
 
58
.RE
 
59
.\}
 
60
.PP
 
61
If you do not name any tables following
 
62
\fIdb_name\fR
 
63
or if you use the
 
64
\fB\-\-databases\fR
 
65
or
 
66
\fB\-\-all\-databases\fR
 
67
option, entire databases are dumped\&.
 
68
.PP
 
69
\fBmysqldump\fR
 
70
does not dump the
 
71
INFORMATION_SCHEMA
 
72
database by default\&. As of MySQL 5\&.1\&.38,
 
73
\fBmysqldump\fR
 
74
dumps
 
75
INFORMATION_SCHEMA
 
76
if you name it explicitly on the command line, although currently you must also use the
 
77
\fB\-\-skip\-lock\-tables\fR
 
78
option\&. Before 5\&.1\&.38,
 
79
\fBmysqldump\fR
 
80
silently ignores
 
81
INFORMATION_SCHEMA
 
82
even if you name it explicitly on the command line\&.
 
83
.PP
 
84
To see a list of the options your version of
 
85
\fBmysqldump\fR
 
86
supports, execute
 
87
\fBmysqldump \-\-help\fR\&.
 
88
.PP
 
89
Some
 
90
\fBmysqldump\fR
 
91
options are shorthand for groups of other options:
 
92
.sp
 
93
.RS 4
 
94
.ie n \{\
 
95
\h'-04'\(bu\h'+03'\c
 
96
.\}
 
97
.el \{\
 
98
.sp -1
 
99
.IP \(bu 2.3
 
100
.\}
 
101
Use of
 
102
\fB\-\-opt\fR
 
103
is the same as specifying
 
104
\fB\-\-add\-drop\-table\fR,
 
105
\fB\-\-add\-locks\fR,
 
106
\fB\-\-create\-options\fR,
 
107
\fB\-\-disable\-keys\fR,
 
108
\fB\-\-extended\-insert\fR,
 
109
\fB\-\-lock\-tables\fR,
 
110
\fB\-\-quick\fR, and
 
111
\fB\-\-set\-charset\fR\&. All of the options that
 
112
\fB\-\-opt\fR
 
113
stands for also are on by default because
 
114
\fB\-\-opt\fR
 
115
is on by default\&.
 
116
.RE
 
117
.sp
 
118
.RS 4
 
119
.ie n \{\
 
120
\h'-04'\(bu\h'+03'\c
 
121
.\}
 
122
.el \{\
 
123
.sp -1
 
124
.IP \(bu 2.3
 
125
.\}
 
126
Use of
 
127
\fB\-\-compact\fR
 
128
is the same as specifying
 
129
\fB\-\-skip\-add\-drop\-table\fR,
 
130
\fB\-\-skip\-add\-locks\fR,
 
131
\fB\-\-skip\-comments\fR,
 
132
\fB\-\-skip\-disable\-keys\fR, and
 
133
\fB\-\-skip\-set\-charset\fR
 
134
options\&.
 
135
.RE
 
136
.PP
 
137
To reverse the effect of a group option, uses its
 
138
\fB\-\-skip\-\fR\fB\fIxxx\fR\fR
 
139
form (\fB\-\-skip\-opt\fR
 
140
or
 
141
\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:
 
142
.sp
 
143
.RS 4
 
144
.ie n \{\
 
145
\h'-04'\(bu\h'+03'\c
 
146
.\}
 
147
.el \{\
 
148
.sp -1
 
149
.IP \(bu 2.3
 
150
.\}
 
151
To select the effect of
 
152
\fB\-\-opt\fR
 
153
except for some features, use the
 
154
\fB\-\-skip\fR
 
155
option for each feature\&. To disable extended inserts and memory buffering, use
 
156
\fB\-\-opt\fR
 
157
\fB\-\-skip\-extended\-insert\fR
 
158
\fB\-\-skip\-quick\fR\&. (Actually,
 
159
\fB\-\-skip\-extended\-insert\fR
 
160
\fB\-\-skip\-quick\fR
 
161
is sufficient because
 
162
\fB\-\-opt\fR
 
163
is on by default\&.)
 
164
.RE
 
165
.sp
 
166
.RS 4
 
167
.ie n \{\
 
168
\h'-04'\(bu\h'+03'\c
 
169
.\}
 
170
.el \{\
 
171
.sp -1
 
172
.IP \(bu 2.3
 
173
.\}
 
174
To reverse
 
175
\fB\-\-opt\fR
 
176
for all features except index disabling and table locking, use
 
177
\fB\-\-skip\-opt\fR
 
178
\fB\-\-disable\-keys\fR
 
179
\fB\-\-lock\-tables\fR\&.
 
180
.RE
 
181
.PP
 
182
When you selectively enable or disable the effect of a group option, order is important because options are processed first to last\&. For example,
 
183
\fB\-\-disable\-keys\fR
 
184
\fB\-\-lock\-tables\fR
 
185
\fB\-\-skip\-opt\fR
 
186
would not have the intended effect; it is the same as
 
187
\fB\-\-skip\-opt\fR
 
188
by itself\&.
 
189
.PP
 
190
\fBmysqldump\fR
 
191
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
 
192
\fB\-\-quick\fR
 
193
option (or
 
194
\fB\-\-opt\fR, which enables
 
195
\fB\-\-quick\fR)\&. The
 
196
\fB\-\-opt\fR
 
197
option (and hence
 
198
\fB\-\-quick\fR) is enabled by default, so to enable memory buffering, use
 
199
\fB\-\-skip\-quick\fR\&.
 
200
.PP
 
201
If you are using a recent version of
 
202
\fBmysqldump\fR
 
203
to generate a dump to be reloaded into a very old MySQL server, you should not use the
 
204
\fB\-\-opt\fR
 
205
or
 
206
\fB\-\-extended\-insert\fR
 
207
option\&. Use
 
208
\fB\-\-skip\-opt\fR
 
209
instead\&.
 
210
.if n \{\
 
211
.sp
 
212
.\}
 
213
.RS 4
 
214
.it 1 an-trap
 
215
.nr an-no-space-flag 1
 
216
.nr an-break-flag 1
 
217
.br
 
218
.ps +1
 
219
\fBNote\fR
 
220
.ps -1
 
221
.br
 
222
.PP
 
223
\fBmysqldump\fR
 
224
from MySQL 5\&.1\&.21 cannot be used to create dumps from MySQL server 5\&.1\&.20 and older\&. This issue is fixed in MySQL 5\&.1\&.22\&. (\m[blue]\fBBug#30123\fR\m[]\&\s-2\u[1]\d\s+2)
 
225
.sp .5v
 
226
.RE
 
227
.PP
 
228
\fBmysqldump\fR
 
229
supports the following options, which can be specified on the command line or in the
 
230
[mysqldump]
 
231
and
 
232
[client]
 
233
option file groups\&.
 
234
\fBmysqldump\fR
 
235
also supports the options for processing option files described at
 
236
Section\ \&4.2.3.3.1, \(lqCommand-Line Options that Affect Option-File Handling\(rq\&.
 
237
.sp
 
238
.RS 4
 
239
.ie n \{\
 
240
\h'-04'\(bu\h'+03'\c
 
241
.\}
 
242
.el \{\
 
243
.sp -1
 
244
.IP \(bu 2.3
 
245
.\}
 
246
.\" mysqldump: help option
 
247
.\" help option: mysqldump
 
248
\fB\-\-help\fR,
 
249
\fB\-?\fR
 
250
.sp
 
251
Display a help message and exit\&.
 
252
.RE
 
253
.sp
 
254
.RS 4
 
255
.ie n \{\
 
256
\h'-04'\(bu\h'+03'\c
 
257
.\}
 
258
.el \{\
 
259
.sp -1
 
260
.IP \(bu 2.3
 
261
.\}
 
262
.\" mysqldump: add-drop-database option
 
263
.\" add-drop-database option: mysqldump
 
264
\fB\-\-add\-drop\-database\fR
 
265
.sp
 
266
Add a
 
267
DROP DATABASE
 
268
statement before each
 
269
CREATE DATABASE
 
270
statement\&. This option is typically used in conjunction with the
 
271
\fB\-\-all\-databases\fR
 
272
or
 
273
\fB\-\-databases\fR
 
274
option because no
 
275
CREATE DATABASE
 
276
statements are written unless one of those options is specified\&.
 
277
.RE
 
278
.sp
 
279
.RS 4
 
280
.ie n \{\
 
281
\h'-04'\(bu\h'+03'\c
 
282
.\}
 
283
.el \{\
 
284
.sp -1
 
285
.IP \(bu 2.3
 
286
.\}
 
287
.\" mysqldump: add-drop-table option
 
288
.\" add-drop-table option: mysqldump
 
289
\fB\-\-add\-drop\-table\fR
 
290
.sp
 
291
Add a
 
292
DROP TABLE
 
293
statement before each
 
294
CREATE TABLE
 
295
statement\&.
 
296
.RE
 
297
.sp
 
298
.RS 4
 
299
.ie n \{\
 
300
\h'-04'\(bu\h'+03'\c
 
301
.\}
 
302
.el \{\
 
303
.sp -1
 
304
.IP \(bu 2.3
 
305
.\}
 
306
.\" mysqldump: add-locks option
 
307
.\" add-locks option: mysqldump
 
308
\fB\-\-add\-locks\fR
 
309
.sp
 
310
Surround each table dump with
 
311
LOCK TABLES
 
312
and
 
313
UNLOCK TABLES
 
314
statements\&. This results in faster inserts when the dump file is reloaded\&. See
 
315
Section\ \&7.2.21, \(lqSpeed of INSERT Statements\(rq\&.
 
316
.RE
 
317
.sp
 
318
.RS 4
 
319
.ie n \{\
 
320
\h'-04'\(bu\h'+03'\c
 
321
.\}
 
322
.el \{\
 
323
.sp -1
 
324
.IP \(bu 2.3
 
325
.\}
 
326
.\" mysqldump: all-databases option
 
327
.\" all-databases option: mysqldump
 
328
\fB\-\-all\-databases\fR,
 
329
\fB\-A\fR
 
330
.sp
 
331
Dump all tables in all databases\&. This is the same as using the
 
332
\fB\-\-databases\fR
 
333
option and naming all the databases on the command line\&.
 
334
.RE
 
335
.sp
 
336
.RS 4
 
337
.ie n \{\
 
338
\h'-04'\(bu\h'+03'\c
 
339
.\}
 
340
.el \{\
 
341
.sp -1
 
342
.IP \(bu 2.3
 
343
.\}
 
344
.\" mysqldump: all-tablespaces option
 
345
.\" all-tablespaces option: mysqldump
 
346
\fB\-\-all\-tablespaces\fR,
 
347
\fB\-Y\fR
 
348
.sp
 
349
Adds to a table dump all SQL statements needed to create any tablespaces used by an
 
350
NDBCLUSTER
 
351
table\&. This information is not otherwise included in the output from
 
352
\fBmysqldump\fR\&. This option is currently relevant only to MySQL Cluster tables\&.
 
353
.sp
 
354
This option was added in MySQL 5\&.1\&.6\&.
 
355
.RE
 
356
.sp
 
357
.RS 4
 
358
.ie n \{\
 
359
\h'-04'\(bu\h'+03'\c
 
360
.\}
 
361
.el \{\
 
362
.sp -1
 
363
.IP \(bu 2.3
 
364
.\}
 
365
.\" mysqldump: allow-keywords option
 
366
.\" allow-keywords option: mysqldump
 
367
\fB\-\-allow\-keywords\fR
 
368
.sp
 
369
Allow creation of column names that are keywords\&. This works by prefixing each column name with the table name\&.
 
370
.RE
 
371
.sp
 
372
.RS 4
 
373
.ie n \{\
 
374
\h'-04'\(bu\h'+03'\c
 
375
.\}
 
376
.el \{\
 
377
.sp -1
 
378
.IP \(bu 2.3
 
379
.\}
 
380
.\" mysqldump: character-sets-dir option
 
381
.\" character-sets-dir option: mysqldump
 
382
\fB\-\-character\-sets\-dir=\fR\fB\fIpath\fR\fR
 
383
.sp
 
384
The directory where character sets are installed\&. See
 
385
Section\ \&9.5, \(lqCharacter Set Configuration\(rq\&.
 
386
.RE
 
387
.sp
 
388
.RS 4
 
389
.ie n \{\
 
390
\h'-04'\(bu\h'+03'\c
 
391
.\}
 
392
.el \{\
 
393
.sp -1
 
394
.IP \(bu 2.3
 
395
.\}
 
396
.\" mysqldump: comments option
 
397
.\" comments option: mysqldump
 
398
\fB\-\-comments\fR,
 
399
\fB\-i\fR
 
400
.sp
 
401
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
 
402
\fB\-\-skip\-comments\fR\&.
 
403
.RE
 
404
.sp
 
405
.RS 4
 
406
.ie n \{\
 
407
\h'-04'\(bu\h'+03'\c
 
408
.\}
 
409
.el \{\
 
410
.sp -1
 
411
.IP \(bu 2.3
 
412
.\}
 
413
.\" mysqldump: compact option
 
414
.\" compact option: mysqldump
 
415
\fB\-\-compact\fR
 
416
.sp
 
417
Produce more compact output\&. This option enables the
 
418
\fB\-\-skip\-add\-drop\-table\fR,
 
419
\fB\-\-skip\-add\-locks\fR,
 
420
\fB\-\-skip\-comments\fR,
 
421
\fB\-\-skip\-disable\-keys\fR, and
 
422
\fB\-\-skip\-set\-charset\fR
 
423
options\&.
 
424
.if n \{\
 
425
.sp
 
426
.\}
 
427
.RS 4
 
428
.it 1 an-trap
 
429
.nr an-no-space-flag 1
 
430
.nr an-break-flag 1
 
431
.br
 
432
.ps +1
 
433
\fBNote\fR
 
434
.ps -1
 
435
.br
 
436
Prior to MySQL 5\&.1\&.21, this option did not create valid SQL if the database dump contained views\&. The recreation of views requires the creation and removal of temporary tables and this option suppressed the removal of those temporary tables\&. As a workaround, use
 
437
\fB\-\-compact\fR
 
438
with the
 
439
\fB\-\-add\-drop\-table\fR
 
440
option and then manually adjust the dump file\&.
 
441
.sp .5v
 
442
.RE
 
443
.RE
 
444
.sp
 
445
.RS 4
 
446
.ie n \{\
 
447
\h'-04'\(bu\h'+03'\c
 
448
.\}
 
449
.el \{\
 
450
.sp -1
 
451
.IP \(bu 2.3
 
452
.\}
 
453
.\" mysqldump: compatible option
 
454
.\" compatible option: mysqldump
 
455
\fB\-\-compatible=\fR\fB\fIname\fR\fR
 
456
.sp
 
457
Produce output that is more compatible with other database systems or with older MySQL servers\&. The value of
 
458
\fIname\fR
 
459
can be
 
460
ansi,
 
461
mysql323,
 
462
mysql40,
 
463
postgresql,
 
464
oracle,
 
465
mssql,
 
466
db2,
 
467
maxdb,
 
468
no_key_options,
 
469
no_table_options, or
 
470
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
 
471
Section\ \&5.1.8, \(lqServer SQL Modes\(rq\&.
 
472
.sp
 
473
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,
 
474
\fB\-\-compatible=oracle\fR
 
475
does not map data types to Oracle types or use Oracle comment syntax\&.
 
476
.sp
 
477
\fIThis option requires a server version of 4\&.1\&.0 or higher\fR\&. With older servers, it does nothing\&.
 
478
.RE
 
479
.sp
 
480
.RS 4
 
481
.ie n \{\
 
482
\h'-04'\(bu\h'+03'\c
 
483
.\}
 
484
.el \{\
 
485
.sp -1
 
486
.IP \(bu 2.3
 
487
.\}
 
488
.\" mysqldump: complete-insert option
 
489
.\" complete-insert option: mysqldump
 
490
\fB\-\-complete\-insert\fR,
 
491
\fB\-c\fR
 
492
.sp
 
493
Use complete
 
494
INSERT
 
495
statements that include column names\&.
 
496
.RE
 
497
.sp
 
498
.RS 4
 
499
.ie n \{\
 
500
\h'-04'\(bu\h'+03'\c
 
501
.\}
 
502
.el \{\
 
503
.sp -1
 
504
.IP \(bu 2.3
 
505
.\}
 
506
.\" mysqldump: compress option
 
507
.\" compress option: mysqldump
 
508
\fB\-\-compress\fR,
 
509
\fB\-C\fR
 
510
.sp
 
511
Compress all information sent between the client and the server if both support compression\&.
 
512
.RE
 
513
.sp
 
514
.RS 4
 
515
.ie n \{\
 
516
\h'-04'\(bu\h'+03'\c
 
517
.\}
 
518
.el \{\
 
519
.sp -1
 
520
.IP \(bu 2.3
 
521
.\}
 
522
.\" mysqldump: create-options option
 
523
.\" create-options option: mysqldump
 
524
\fB\-\-create\-options\fR,
 
525
\fB\-a\fR
 
526
.sp
 
527
Include all MySQL\-specific table options in the
 
528
CREATE TABLE
 
529
statements\&.
 
530
.RE
 
531
.sp
 
532
.RS 4
 
533
.ie n \{\
 
534
\h'-04'\(bu\h'+03'\c
 
535
.\}
 
536
.el \{\
 
537
.sp -1
 
538
.IP \(bu 2.3
 
539
.\}
 
540
.\" mysqldump: databases option
 
541
.\" databases option: mysqldump
 
542
\fB\-\-databases\fR,
 
543
\fB\-B\fR
 
544
.sp
 
545
Dump several databases\&. Normally,
 
546
\fBmysqldump\fR
 
547
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\&.
 
548
CREATE DATABASE
 
549
and
 
550
USE
 
551
statements are included in the output before each new database\&.
 
552
.RE
 
553
.sp
 
554
.RS 4
 
555
.ie n \{\
 
556
\h'-04'\(bu\h'+03'\c
 
557
.\}
 
558
.el \{\
 
559
.sp -1
 
560
.IP \(bu 2.3
 
561
.\}
 
562
.\" mysqldump: debug option
 
563
.\" debug option: mysqldump
 
564
\fB\-\-debug[=\fR\fB\fIdebug_options\fR\fR\fB]\fR,
 
565
\fB\-# [\fR\fB\fIdebug_options\fR\fR\fB]\fR
 
566
.sp
 
567
Write a debugging log\&. A typical
 
568
\fIdebug_options\fR
 
569
string is
 
570
\'d:t:o,\fIfile_name\fR\'\&. The default value is
 
571
\'d:t:o,/tmp/mysqldump\&.trace\'\&.
 
572
.RE
 
573
.sp
 
574
.RS 4
 
575
.ie n \{\
 
576
\h'-04'\(bu\h'+03'\c
 
577
.\}
 
578
.el \{\
 
579
.sp -1
 
580
.IP \(bu 2.3
 
581
.\}
 
582
.\" mysqldump: debug-check option
 
583
.\" debug-check option: mysqldump
 
584
\fB\-\-debug\-check\fR
 
585
.sp
 
586
Print some debugging information when the program exits\&. This option was added in MySQL 5\&.1\&.21\&.
 
587
.RE
 
588
.sp
 
589
.RS 4
 
590
.ie n \{\
 
591
\h'-04'\(bu\h'+03'\c
 
592
.\}
 
593
.el \{\
 
594
.sp -1
 
595
.IP \(bu 2.3
 
596
.\}
 
597
.\" mysqldump: debug-info option
 
598
.\" debug-info option: mysqldump
 
599
\fB\-\-debug\-info\fR
 
600
.sp
 
601
Print debugging information and memory and CPU usage statistics when the program exits\&. This option was added in MySQL 5\&.1\&.14\&.
 
602
.RE
 
603
.sp
 
604
.RS 4
 
605
.ie n \{\
 
606
\h'-04'\(bu\h'+03'\c
 
607
.\}
 
608
.el \{\
 
609
.sp -1
 
610
.IP \(bu 2.3
 
611
.\}
 
612
.\" mysqldump: default-character-set option
 
613
.\" default-character-set option: mysqldump
 
614
\fB\-\-default\-character\-set=\fR\fB\fIcharset_name\fR\fR
 
615
.sp
 
616
Use
 
617
\fIcharset_name\fR
 
618
as the default character set\&. See
 
619
Section\ \&9.5, \(lqCharacter Set Configuration\(rq\&. If no character set is specified,
 
620
\fBmysqldump\fR
 
621
uses
 
622
utf8, and earlier versions use
 
623
latin1\&.
 
624
.sp
 
625
Prior to MySQL 5\&.1\&.38, this option has no effect for output data files produced by using the
 
626
\fB\-\-tab\fR
 
627
option\&. See the description for that option\&.
 
628
.RE
 
629
.sp
 
630
.RS 4
 
631
.ie n \{\
 
632
\h'-04'\(bu\h'+03'\c
 
633
.\}
 
634
.el \{\
 
635
.sp -1
 
636
.IP \(bu 2.3
 
637
.\}
 
638
.\" mysqldump: defaults-extra-file option
 
639
.\" defaults-extra-file option: mysqldump
 
640
\fB\-\-defaults\-extra\-file=\fR\fB\fIfilename\fR\fR
 
641
.sp
 
642
Set \fB\fIfilename\fR\fR as the file to read default options from after the global defaults files has been read\&.
 
643
Must be given as first option\&.
 
644
.RE
 
645
.sp
 
646
.RS 4
 
647
.ie n \{\
 
648
\h'-04'\(bu\h'+03'\c
 
649
.\}
 
650
.el \{\
 
651
.sp -1
 
652
.IP \(bu 2.3
 
653
.\}
 
654
.\" mysqldump: defaults-file option
 
655
.\" defaults-file option: mysqldump
 
656
\fB\-\-defaults\-file=\fR\fB\fIfilename\fR\fR
 
657
.sp
 
658
Set \fB\fIfilename\fR\fR as the file to read default options from, override global defaults files\&.
 
659
Must be given as first option\&.
 
660
.RE
 
661
.sp
 
662
.RS 4
 
663
.ie n \{\
 
664
\h'-04'\(bu\h'+03'\c
 
665
.\}
 
666
.el \{\
 
667
.sp -1
 
668
.IP \(bu 2.3
 
669
.\}
 
670
.\" mysqldump: delayed-insert option
 
671
.\" delayed-insert option: mysqldump
 
672
\fB\-\-delayed\-insert\fR
 
673
.sp
 
674
Write
 
675
INSERT DELAYED
 
676
statements rather than
 
677
INSERT
 
678
statements\&.
 
679
.RE
 
680
.sp
 
681
.RS 4
 
682
.ie n \{\
 
683
\h'-04'\(bu\h'+03'\c
 
684
.\}
 
685
.el \{\
 
686
.sp -1
 
687
.IP \(bu 2.3
 
688
.\}
 
689
.\" mysqldump: delete-master-logs option
 
690
.\" delete-master-logs option: mysqldump
 
691
\fB\-\-delete\-master\-logs\fR
 
692
.sp
 
693
On a master replication server, delete the binary logs by sending a
 
694
PURGE BINARY LOGS
 
695
statement to the server after performing the dump operation\&. This option automatically enables
 
696
\fB\-\-master\-data\fR\&.
 
697
.RE
 
698
.sp
 
699
.RS 4
 
700
.ie n \{\
 
701
\h'-04'\(bu\h'+03'\c
 
702
.\}
 
703
.el \{\
 
704
.sp -1
 
705
.IP \(bu 2.3
 
706
.\}
 
707
.\" mysqldump: disable-keys option
 
708
.\" disable-keys option: mysqldump
 
709
\fB\-\-disable\-keys\fR,
 
710
\fB\-K\fR
 
711
.sp
 
712
For each table, surround the
 
713
INSERT
 
714
statements with
 
715
/*!40000 ALTER TABLE \fItbl_name\fR DISABLE KEYS */;
 
716
and
 
717
/*!40000 ALTER TABLE \fItbl_name\fR ENABLE KEYS */;
 
718
statements\&. This makes loading the dump file faster because the indexes are created after all rows are inserted\&. This option is effective only for nonunique indexes of
 
719
MyISAM
 
720
tables\&.
 
721
.RE
 
722
.sp
 
723
.RS 4
 
724
.ie n \{\
 
725
\h'-04'\(bu\h'+03'\c
 
726
.\}
 
727
.el \{\
 
728
.sp -1
 
729
.IP \(bu 2.3
 
730
.\}
 
731
.\" mysqldump: dump-date option
 
732
.\" dump-date option: mysqldump
 
733
\fB\-\-dump\-date\fR
 
734
.sp
 
735
If the
 
736
\fB\-\-comments\fR
 
737
option is given,
 
738
\fBmysqldump\fR
 
739
produces a comment at the end of the dump of the following form:
 
740
.sp
 
741
.if n \{\
 
742
.RS 4
 
743
.\}
 
744
.nf
 
745
\-\- Dump completed on \fIDATE\fR
 
746
.fi
 
747
.if n \{\
 
748
.RE
 
749
.\}
 
750
.sp
 
751
However, the date causes dump files taken at different times to appear to be different, even if the data are otherwise identical\&.
 
752
\fB\-\-dump\-date\fR
 
753
and
 
754
\fB\-\-skip\-dump\-date\fR
 
755
control whether the date is added to the comment\&. The default is
 
756
\fB\-\-dump\-date\fR
 
757
(include the date in the comment)\&.
 
758
\fB\-\-skip\-dump\-date\fR
 
759
suppresses date printing\&. This option was added in MySQL 5\&.1\&.23\&.
 
760
.RE
 
761
.sp
 
762
.RS 4
 
763
.ie n \{\
 
764
\h'-04'\(bu\h'+03'\c
 
765
.\}
 
766
.el \{\
 
767
.sp -1
 
768
.IP \(bu 2.3
 
769
.\}
 
770
.\" mysqldump: events option
 
771
.\" events option: mysqldump
 
772
\fB\-\-events\fR,
 
773
\fB\-E\fR
 
774
.sp
 
775
Include Event Scheduler events for the dumped databases in the output\&. This option was added in MySQL 5\&.1\&.8\&.
 
776
.RE
 
777
.sp
 
778
.RS 4
 
779
.ie n \{\
 
780
\h'-04'\(bu\h'+03'\c
 
781
.\}
 
782
.el \{\
 
783
.sp -1
 
784
.IP \(bu 2.3
 
785
.\}
 
786
.\" mysqldump: extended-insert option
 
787
.\" extended-insert option: mysqldump
 
788
\fB\-\-extended\-insert\fR,
 
789
\fB\-e\fR
 
790
.sp
 
791
Use multiple\-row
 
792
INSERT
 
793
syntax that include several
 
794
VALUES
 
795
lists\&. This results in a smaller dump file and speeds up inserts when the file is reloaded\&.
 
796
.RE
 
797
.sp
 
798
.RS 4
 
799
.ie n \{\
 
800
\h'-04'\(bu\h'+03'\c
 
801
.\}
 
802
.el \{\
 
803
.sp -1
 
804
.IP \(bu 2.3
 
805
.\}
 
806
.\" mysqldump: fields-terminated-by option
 
807
.\" fields-terminated-by option: mysqldump
 
808
\fB\-\-fields\-terminated\-by=\&.\&.\&.\fR,
 
809
.\" mysqldump: fields-enclosed-by option
 
810
.\" fields-enclosed-by option: mysqldump
 
811
\fB\-\-fields\-enclosed\-by=\&.\&.\&.\fR,
 
812
.\" mysqldump: fields-optionally-enclosed-by option
 
813
.\" fields-optionally-enclosed-by option: mysqldump
 
814
\fB\-\-fields\-optionally\-enclosed\-by=\&.\&.\&.\fR,
 
815
.\" mysqldump: fields-escaped-by option
 
816
.\" fields-escaped-by option: mysqldump
 
817
\fB\-\-fields\-escaped\-by=\&.\&.\&.\fR
 
818
.sp
 
819
These options are used with the
 
820
\fB\-\-tab\fR
 
821
option and have the same meaning as the corresponding
 
822
FIELDS
 
823
clauses for
 
824
LOAD DATA INFILE\&. See
 
825
Section\ \&12.2.6, \(lqLOAD DATA INFILE Syntax\(rq\&.
 
826
.RE
 
827
.sp
 
828
.RS 4
 
829
.ie n \{\
 
830
\h'-04'\(bu\h'+03'\c
 
831
.\}
 
832
.el \{\
 
833
.sp -1
 
834
.IP \(bu 2.3
 
835
.\}
 
836
.\" mysqldump: first-slave option
 
837
.\" first-slave option: mysqldump
 
838
\fB\-\-first\-slave\fR
 
839
.sp
 
840
Deprecated\&. Use
 
841
\fB\-\-lock\-all\-tables\fR
 
842
instead\&.
 
843
\fB\-\-first\-slave\fR
 
844
is removed in MySQL 5\&.5\&.
 
845
.RE
 
846
.sp
 
847
.RS 4
 
848
.ie n \{\
 
849
\h'-04'\(bu\h'+03'\c
 
850
.\}
 
851
.el \{\
 
852
.sp -1
 
853
.IP \(bu 2.3
 
854
.\}
 
855
.\" mysqldump: flush-logs option
 
856
.\" flush-logs option: mysqldump
 
857
\fB\-\-flush\-logs\fR,
 
858
\fB\-F\fR
 
859
.sp
 
860
Flush the MySQL server log files before starting the dump\&. This option requires the
 
861
RELOAD
 
862
privilege\&. If you use this option in combination with the
 
863
\fB\-\-all\-databases\fR
 
864
option, the logs are flushed
 
865
\fIfor each database dumped\fR\&. The exception is when using
 
866
\fB\-\-lock\-all\-tables\fR
 
867
or
 
868
\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
 
869
\fB\-\-flush\-logs\fR
 
870
together with either
 
871
\fB\-\-lock\-all\-tables\fR
 
872
or
 
873
\fB\-\-master\-data\fR\&.
 
874
.RE
 
875
.sp
 
876
.RS 4
 
877
.ie n \{\
 
878
\h'-04'\(bu\h'+03'\c
 
879
.\}
 
880
.el \{\
 
881
.sp -1
 
882
.IP \(bu 2.3
 
883
.\}
 
884
.\" mysqldump: flush-privileges option
 
885
.\" flush-privileges option: mysqldump
 
886
\fB\-\-flush\-privileges\fR
 
887
.sp
 
888
Send a
 
889
FLUSH PRIVILEGES
 
890
statement to the server after dumping the
 
891
mysql
 
892
database\&. This option should be used any time the dump contains the
 
893
mysql
 
894
database and any other database that depends on the data in the
 
895
mysql
 
896
database for proper restoration\&. This option was added in MySQL 5\&.1\&.12\&.
 
897
.RE
 
898
.sp
 
899
.RS 4
 
900
.ie n \{\
 
901
\h'-04'\(bu\h'+03'\c
 
902
.\}
 
903
.el \{\
 
904
.sp -1
 
905
.IP \(bu 2.3
 
906
.\}
 
907
.\" mysqldump: force option
 
908
.\" force option: mysqldump
 
909
\fB\-\-force\fR,
 
910
\fB\-f\fR
 
911
.sp
 
912
Continue even if an SQL error occurs during a table dump\&.
 
913
.sp
 
914
One use for this option is to cause
 
915
\fBmysqldump\fR
 
916
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
 
917
\fB\-\-force\fR,
 
918
\fBmysqldump\fR
 
919
exits with an error message\&. With
 
920
\fB\-\-force\fR,
 
921
\fBmysqldump\fR
 
922
prints the error message, but it also writes an SQL comment containing the view definition to the dump output and continues executing\&.
 
923
.RE
 
924
.sp
 
925
.RS 4
 
926
.ie n \{\
 
927
\h'-04'\(bu\h'+03'\c
 
928
.\}
 
929
.el \{\
 
930
.sp -1
 
931
.IP \(bu 2.3
 
932
.\}
 
933
.\" mysqldump: host option
 
934
.\" host option: mysqldump
 
935
\fB\-\-host=\fR\fB\fIhost_name\fR\fR,
 
936
\fB\-h \fR\fB\fIhost_name\fR\fR
 
937
.sp
 
938
Dump data from the MySQL server on the given host\&. The default host is
 
939
localhost\&.
 
940
.RE
 
941
.sp
 
942
.RS 4
 
943
.ie n \{\
 
944
\h'-04'\(bu\h'+03'\c
 
945
.\}
 
946
.el \{\
 
947
.sp -1
 
948
.IP \(bu 2.3
 
949
.\}
 
950
.\" mysqldump: hex-blob option
 
951
.\" hex-blob option: mysqldump
 
952
\fB\-\-hex\-blob\fR
 
953
.sp
 
954
Dump binary columns using hexadecimal notation (for example,
 
955
\'abc\'
 
956
becomes
 
957
0x616263)\&. The affected data types are
 
958
BINARY,
 
959
VARBINARY, the
 
960
BLOB
 
961
types, and
 
962
BIT\&.
 
963
.RE
 
964
.sp
 
965
.RS 4
 
966
.ie n \{\
 
967
\h'-04'\(bu\h'+03'\c
 
968
.\}
 
969
.el \{\
 
970
.sp -1
 
971
.IP \(bu 2.3
 
972
.\}
 
973
.\" mysqldump: ignore-table option
 
974
.\" ignore-table option: mysqldump
 
975
\fB\-\-ignore\-table=\fR\fB\fIdb_name\&.tbl_name\fR\fR
 
976
.sp
 
977
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\&.
 
978
.RE
 
979
.sp
 
980
.RS 4
 
981
.ie n \{\
 
982
\h'-04'\(bu\h'+03'\c
 
983
.\}
 
984
.el \{\
 
985
.sp -1
 
986
.IP \(bu 2.3
 
987
.\}
 
988
.\" mysqldump: insert-ignore option
 
989
.\" insert-ignore option: mysqldump
 
990
\fB\-\-insert\-ignore\fR
 
991
.sp
 
992
Write
 
993
INSERT IGNORE
 
994
statements rather than
 
995
INSERT
 
996
statements\&.
 
997
.RE
 
998
.sp
 
999
.RS 4
 
1000
.ie n \{\
 
1001
\h'-04'\(bu\h'+03'\c
 
1002
.\}
 
1003
.el \{\
 
1004
.sp -1
 
1005
.IP \(bu 2.3
 
1006
.\}
 
1007
.\" mysqldump: lines-terminated-by option
 
1008
.\" lines-terminated-by option: mysqldump
 
1009
\fB\-\-lines\-terminated\-by=\&.\&.\&.\fR
 
1010
.sp
 
1011
This option is used with the
 
1012
\fB\-\-tab\fR
 
1013
option and has the same meaning as the corresponding
 
1014
LINES
 
1015
clause for
 
1016
LOAD DATA INFILE\&. See
 
1017
Section\ \&12.2.6, \(lqLOAD DATA INFILE Syntax\(rq\&.
 
1018
.RE
 
1019
.sp
 
1020
.RS 4
 
1021
.ie n \{\
 
1022
\h'-04'\(bu\h'+03'\c
 
1023
.\}
 
1024
.el \{\
 
1025
.sp -1
 
1026
.IP \(bu 2.3
 
1027
.\}
 
1028
.\" mysqldump: lock-all-tables option
 
1029
.\" lock-all-tables option: mysqldump
 
1030
\fB\-\-lock\-all\-tables\fR,
 
1031
\fB\-x\fR
 
1032
.sp
 
1033
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
 
1034
\fB\-\-single\-transaction\fR
 
1035
and
 
1036
\fB\-\-lock\-tables\fR\&.
 
1037
.RE
 
1038
.sp
 
1039
.RS 4
 
1040
.ie n \{\
 
1041
\h'-04'\(bu\h'+03'\c
 
1042
.\}
 
1043
.el \{\
 
1044
.sp -1
 
1045
.IP \(bu 2.3
 
1046
.\}
 
1047
.\" mysqldump: lock-tables option
 
1048
.\" lock-tables option: mysqldump
 
1049
\fB\-\-lock\-tables\fR,
 
1050
\fB\-l\fR
 
1051
.sp
 
1052
For each dumped database, lock all tables to be dumped before dumping them\&. The tables are locked with
 
1053
READ LOCAL
 
1054
to allow concurrent inserts in the case of
 
1055
MyISAM
 
1056
tables\&. For transactional tables such as
 
1057
InnoDB,
 
1058
\fB\-\-single\-transaction\fR
 
1059
is a much better option than
 
1060
\fB\-\-lock\-tables\fR
 
1061
because it does not need to lock the tables at all\&.
 
1062
.sp
 
1063
Because
 
1064
\fB\-\-lock\-tables\fR
 
1065
locks tables for each database separately, 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\&.
 
1066
.RE
 
1067
.sp
 
1068
.RS 4
 
1069
.ie n \{\
 
1070
\h'-04'\(bu\h'+03'\c
 
1071
.\}
 
1072
.el \{\
 
1073
.sp -1
 
1074
.IP \(bu 2.3
 
1075
.\}
 
1076
.\" mysqldump: log-error option
 
1077
.\" log-error option: mysqldump
 
1078
\fB\-\-log\-error=\fR\fB\fIfile_name\fR\fR
 
1079
.sp
 
1080
Log warnings and errors by appending them to the named file\&. The default is to do no logging\&. This option was added in MySQL 5\&.1\&.18\&.
 
1081
.RE
 
1082
.sp
 
1083
.RS 4
 
1084
.ie n \{\
 
1085
\h'-04'\(bu\h'+03'\c
 
1086
.\}
 
1087
.el \{\
 
1088
.sp -1
 
1089
.IP \(bu 2.3
 
1090
.\}
 
1091
.\" mysqldump: master-data option
 
1092
.\" master-data option: mysqldump
 
1093
\fB\-\-master\-data[=\fR\fB\fIvalue\fR\fR\fB]\fR
 
1094
.sp
 
1095
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
 
1096
CHANGE MASTER TO
 
1097
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 after you load the dump file into the slave\&.
 
1098
.sp
 
1099
If the option value is 2, the
 
1100
CHANGE MASTER TO
 
1101
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 is not written as a comment and takes effect when the dump file is reloaded\&. If no option value is specified, the default value is 1\&.
 
1102
.sp
 
1103
This option requires the
 
1104
RELOAD
 
1105
privilege and the binary log must be enabled\&.
 
1106
.sp
 
1107
The
 
1108
\fB\-\-master\-data\fR
 
1109
option automatically turns off
 
1110
\fB\-\-lock\-tables\fR\&. It also turns on
 
1111
\fB\-\-lock\-all\-tables\fR, unless
 
1112
\fB\-\-single\-transaction\fR
 
1113
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
 
1114
\fB\-\-single\-transaction\fR)\&. In all cases, any action on logs happens at the exact moment of the dump\&.
 
1115
.sp
 
1116
It is also possible to set up a slave by dumping an existing slave of the master\&. To do this, use the following procedure on the existing slave:
 
1117
.sp
 
1118
.RS 4
 
1119
.ie n \{\
 
1120
\h'-04' 1.\h'+01'\c
 
1121
.\}
 
1122
.el \{\
 
1123
.sp -1
 
1124
.IP "  1." 4.2
 
1125
.\}
 
1126
Stop the slave\'s SQL thread and get its current status:
 
1127
.sp
 
1128
.if n \{\
 
1129
.RS 4
 
1130
.\}
 
1131
.nf
 
1132
mysql> \fBSTOP SLAVE SQL_THREAD;\fR
 
1133
mysql> \fBSHOW SLAVE STATUS;\fR
 
1134
.fi
 
1135
.if n \{\
 
1136
.RE
 
1137
.\}
 
1138
.RE
 
1139
.sp
 
1140
.RS 4
 
1141
.ie n \{\
 
1142
\h'-04' 2.\h'+01'\c
 
1143
.\}
 
1144
.el \{\
 
1145
.sp -1
 
1146
.IP "  2." 4.2
 
1147
.\}
 
1148
From the output of the
 
1149
SHOW SLAVE STATUS
 
1150
statement, the binary log coordinates of the master server from which the new slave should start replicating are the values of the
 
1151
Relay_Master_Log_File
 
1152
and
 
1153
Exec_Master_Log_Pos
 
1154
fields\&. Denote those values as
 
1155
\fIfile_name\fR
 
1156
and
 
1157
\fIfile_pos\fR\&.
 
1158
.RE
 
1159
.sp
 
1160
.RS 4
 
1161
.ie n \{\
 
1162
\h'-04' 3.\h'+01'\c
 
1163
.\}
 
1164
.el \{\
 
1165
.sp -1
 
1166
.IP "  3." 4.2
 
1167
.\}
 
1168
Dump the slave server:
 
1169
.sp
 
1170
.if n \{\
 
1171
.RS 4
 
1172
.\}
 
1173
.nf
 
1174
shell> \fBmysqldump \-\-master\-data=2 \-\-all\-databases > dumpfile\fR
 
1175
.fi
 
1176
.if n \{\
 
1177
.RE
 
1178
.\}
 
1179
.RE
 
1180
.sp
 
1181
.RS 4
 
1182
.ie n \{\
 
1183
\h'-04' 4.\h'+01'\c
 
1184
.\}
 
1185
.el \{\
 
1186
.sp -1
 
1187
.IP "  4." 4.2
 
1188
.\}
 
1189
Restart the slave:
 
1190
.sp
 
1191
.if n \{\
 
1192
.RS 4
 
1193
.\}
 
1194
.nf
 
1195
mysql> \fBSTART SLAVE;\fR
 
1196
.fi
 
1197
.if n \{\
 
1198
.RE
 
1199
.\}
 
1200
.RE
 
1201
.sp
 
1202
.RS 4
 
1203
.ie n \{\
 
1204
\h'-04' 5.\h'+01'\c
 
1205
.\}
 
1206
.el \{\
 
1207
.sp -1
 
1208
.IP "  5." 4.2
 
1209
.\}
 
1210
On the new slave, load the dump file:
 
1211
.sp
 
1212
.if n \{\
 
1213
.RS 4
 
1214
.\}
 
1215
.nf
 
1216
shell> \fBmysql < dumpfile\fR
 
1217
.fi
 
1218
.if n \{\
 
1219
.RE
 
1220
.\}
 
1221
.RE
 
1222
.sp
 
1223
.RS 4
 
1224
.ie n \{\
 
1225
\h'-04' 6.\h'+01'\c
 
1226
.\}
 
1227
.el \{\
 
1228
.sp -1
 
1229
.IP "  6." 4.2
 
1230
.\}
 
1231
On the new slave, set the replication coordinates to those of the master server obtained earlier:
 
1232
.sp
 
1233
.if n \{\
 
1234
.RS 4
 
1235
.\}
 
1236
.nf
 
1237
mysql> \fBCHANGE MASTER TO\fR
 
1238
    \-> \fBMASTER_LOG_FILE = \'\fR\fB\fIfile_name\fR\fR\fB\', MASTER_LOG_POS = \fR\fB\fIfile_pos\fR\fR\fB;\fR
 
1239
.fi
 
1240
.if n \{\
 
1241
.RE
 
1242
.\}
 
1243
.sp
 
1244
The
 
1245
CHANGE MASTER TO
 
1246
statement might also need other parameters, such as
 
1247
MASTER_HOST
 
1248
to point the slave to the correct master server host\&. Add any such parameters as necessary\&.
 
1249
.RE
 
1250
.RE
 
1251
.sp
 
1252
.RS 4
 
1253
.ie n \{\
 
1254
\h'-04'\(bu\h'+03'\c
 
1255
.\}
 
1256
.el \{\
 
1257
.sp -1
 
1258
.IP \(bu 2.3
 
1259
.\}
 
1260
.\" mysqldump: max-allowed-packet option
 
1261
.\" max-allowed-packet option: mysqldump
 
1262
\fB\-\-max\-allowed\-packet=\fR\fB\fIlength\fR\fR
 
1263
.sp
 
1264
Sets the maximum packet length to send to or recieve from server\&.
 
1265
.RE
 
1266
.sp
 
1267
.RS 4
 
1268
.ie n \{\
 
1269
\h'-04'\(bu\h'+03'\c
 
1270
.\}
 
1271
.el \{\
 
1272
.sp -1
 
1273
.IP \(bu 2.3
 
1274
.\}
 
1275
.\" mysqldump: net-buffer-length option
 
1276
.\" net-buffer-length option: mysqldump
 
1277
\fB\-\-net\-buffer\-length=\fR\fB\fIlength\fR\fR
 
1278
.sp
 
1279
Sets the buffer size for TCP/IP and socket communication\&.
 
1280
.RE
 
1281
.sp
 
1282
.RS 4
 
1283
.ie n \{\
 
1284
\h'-04'\(bu\h'+03'\c
 
1285
.\}
 
1286
.el \{\
 
1287
.sp -1
 
1288
.IP \(bu 2.3
 
1289
.\}
 
1290
.\" mysqldump: no-autocommit option
 
1291
.\" no-autocommit option: mysqldump
 
1292
\fB\-\-no\-autocommit\fR
 
1293
.sp
 
1294
Enclose the
 
1295
INSERT
 
1296
statements for each dumped table within
 
1297
SET autocommit = 0
 
1298
and
 
1299
COMMIT
 
1300
statements\&.
 
1301
.RE
 
1302
.sp
 
1303
.RS 4
 
1304
.ie n \{\
 
1305
\h'-04'\(bu\h'+03'\c
 
1306
.\}
 
1307
.el \{\
 
1308
.sp -1
 
1309
.IP \(bu 2.3
 
1310
.\}
 
1311
.\" mysqldump: no-create-db option
 
1312
.\" no-create-db option: mysqldump
 
1313
\fB\-\-no\-create\-db\fR,
 
1314
\fB\-n\fR
 
1315
.sp
 
1316
This option suppresses the
 
1317
CREATE DATABASE
 
1318
statements that are otherwise included in the output if the
 
1319
\fB\-\-databases\fR
 
1320
or
 
1321
\fB\-\-all\-databases\fR
 
1322
option is given\&.
 
1323
.RE
 
1324
.sp
 
1325
.RS 4
 
1326
.ie n \{\
 
1327
\h'-04'\(bu\h'+03'\c
 
1328
.\}
 
1329
.el \{\
 
1330
.sp -1
 
1331
.IP \(bu 2.3
 
1332
.\}
 
1333
.\" mysqldump: no-create-info option
 
1334
.\" no-create-info option: mysqldump
 
1335
\fB\-\-no\-create\-info\fR,
 
1336
\fB\-t\fR
 
1337
.sp
 
1338
Do not write
 
1339
CREATE TABLE
 
1340
statements that re\-create each dumped table\&.
 
1341
.RE
 
1342
.sp
 
1343
.RS 4
 
1344
.ie n \{\
 
1345
\h'-04'\(bu\h'+03'\c
 
1346
.\}
 
1347
.el \{\
 
1348
.sp -1
 
1349
.IP \(bu 2.3
 
1350
.\}
 
1351
.\" mysqldump: no-data option
 
1352
.\" no-data option: mysqldump
 
1353
\fB\-\-no\-data\fR,
 
1354
\fB\-d\fR
 
1355
.sp
 
1356
Do not write any table row information (that is, do not dump table contents)\&. This is useful if you want to dump only the
 
1357
CREATE TABLE
 
1358
statement for the table (for example, to create an empty copy of the table by loading the dump file)\&.
 
1359
.RE
 
1360
.sp
 
1361
.RS 4
 
1362
.ie n \{\
 
1363
\h'-04'\(bu\h'+03'\c
 
1364
.\}
 
1365
.el \{\
 
1366
.sp -1
 
1367
.IP \(bu 2.3
 
1368
.\}
 
1369
.\" mysqldump: no-defaults option
 
1370
.\" no-defaults option: mysqldump
 
1371
\fB\-\-no\-defaults\fR
 
1372
.sp
 
1373
Do not read default options from any option file\&. This must be given as the first argument\&.
 
1374
.RE
 
1375
.sp
 
1376
.RS 4
 
1377
.ie n \{\
 
1378
\h'-04'\(bu\h'+03'\c
 
1379
.\}
 
1380
.el \{\
 
1381
.sp -1
 
1382
.IP \(bu 2.3
 
1383
.\}
 
1384
.\" mysqldump: no-set-names option
 
1385
.\" no-set-names option: mysqldump
 
1386
\fB\-\-no\-set\-names\fR,
 
1387
\fB\-N\fR
 
1388
.sp
 
1389
This has the same effect as
 
1390
\fB\-\-skip\-set\-charset\fR\&.
 
1391
.RE
 
1392
.sp
 
1393
.RS 4
 
1394
.ie n \{\
 
1395
\h'-04'\(bu\h'+03'\c
 
1396
.\}
 
1397
.el \{\
 
1398
.sp -1
 
1399
.IP \(bu 2.3
 
1400
.\}
 
1401
.\" mysqldump: opt option
 
1402
.\" opt option: mysqldump
 
1403
\fB\-\-opt\fR
 
1404
.sp
 
1405
This option is shorthand\&. It is the same as specifying
 
1406
\fB\-\-add\-drop\-table\fR
 
1407
\fB\-\-add\-locks\fR
 
1408
\fB\-\-create\-options\fR
 
1409
\fB\-\-disable\-keys\fR
 
1410
\fB\-\-extended\-insert\fR
 
1411
\fB\-\-lock\-tables\fR
 
1412
\fB\-\-quick\fR
 
1413
\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\&.
 
1414
.sp
 
1415
\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
 
1416
See the discussion at the beginning of this section for information about selectively enabling or disabling a subset of the options affected by
 
1417
\fB\-\-opt\fR\&.
 
1418
.RE
 
1419
.sp
 
1420
.RS 4
 
1421
.ie n \{\
 
1422
\h'-04'\(bu\h'+03'\c
 
1423
.\}
 
1424
.el \{\
 
1425
.sp -1
 
1426
.IP \(bu 2.3
 
1427
.\}
 
1428
.\" mysqldump: order-by-primary option
 
1429
.\" order-by-primary option: mysqldump
 
1430
\fB\-\-order\-by\-primary\fR
 
1431
.sp
 
1432
Dump each table\'s rows sorted by its primary key, or by its first unique index, if such an index exists\&. This is useful when dumping a
 
1433
MyISAM
 
1434
table to be loaded into an
 
1435
InnoDB
 
1436
table, but will make the dump operation take considerably longer\&.
 
1437
.RE
 
1438
.sp
 
1439
.RS 4
 
1440
.ie n \{\
 
1441
\h'-04'\(bu\h'+03'\c
 
1442
.\}
 
1443
.el \{\
 
1444
.sp -1
 
1445
.IP \(bu 2.3
 
1446
.\}
 
1447
.\" mysqldump: password option
 
1448
.\" password option: mysqldump
 
1449
\fB\-\-password[=\fR\fB\fIpassword\fR\fR\fB]\fR,
 
1450
\fB\-p[\fR\fB\fIpassword\fR\fR\fB]\fR
 
1451
.sp
 
1452
The password to use when connecting to the server\&. If you use the short option form (\fB\-p\fR), you
 
1453
\fIcannot\fR
 
1454
have a space between the option and the password\&. If you omit the
 
1455
\fIpassword\fR
 
1456
value following the
 
1457
\fB\-\-password\fR
 
1458
or
 
1459
\fB\-p\fR
 
1460
option on the command line,
 
1461
\fBmysqldump\fR
 
1462
prompts for one\&.
 
1463
.sp
 
1464
Specifying a password on the command line should be considered insecure\&. See
 
1465
Section\ \&5.3.2.2, \(lqEnd-User Guidelines for Password Security\(rq\&. You can use an option file to avoid giving the password on the command line\&.
 
1466
.RE
 
1467
.sp
 
1468
.RS 4
 
1469
.ie n \{\
 
1470
\h'-04'\(bu\h'+03'\c
 
1471
.\}
 
1472
.el \{\
 
1473
.sp -1
 
1474
.IP \(bu 2.3
 
1475
.\}
 
1476
.\" mysqldump: pipe option
 
1477
.\" pipe option: mysqldump
 
1478
\fB\-\-pipe\fR,
 
1479
\fB\-W\fR
 
1480
.sp
 
1481
On Windows, connect to the server via a named pipe\&. This option applies only if the server supports named\-pipe connections\&.
 
1482
.RE
 
1483
.sp
 
1484
.RS 4
 
1485
.ie n \{\
 
1486
\h'-04'\(bu\h'+03'\c
 
1487
.\}
 
1488
.el \{\
 
1489
.sp -1
 
1490
.IP \(bu 2.3
 
1491
.\}
 
1492
.\" mysqldump: port option
 
1493
.\" port option: mysqldump
 
1494
\fB\-\-port=\fR\fB\fIport_num\fR\fR,
 
1495
\fB\-P \fR\fB\fIport_num\fR\fR
 
1496
.sp
 
1497
The TCP/IP port number to use for the connection\&.
 
1498
.RE
 
1499
.sp
 
1500
.RS 4
 
1501
.ie n \{\
 
1502
\h'-04'\(bu\h'+03'\c
 
1503
.\}
 
1504
.el \{\
 
1505
.sp -1
 
1506
.IP \(bu 2.3
 
1507
.\}
 
1508
.\" mysqldump: protocol option
 
1509
.\" protocol option: mysqldump
 
1510
\fB\-\-protocol={TCP|SOCKET|PIPE|MEMORY}\fR
 
1511
.sp
 
1512
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
 
1513
Section\ \&4.2.2, \(lqConnecting to the MySQL Server\(rq\&.
 
1514
.RE
 
1515
.sp
 
1516
.RS 4
 
1517
.ie n \{\
 
1518
\h'-04'\(bu\h'+03'\c
 
1519
.\}
 
1520
.el \{\
 
1521
.sp -1
 
1522
.IP \(bu 2.3
 
1523
.\}
 
1524
.\" mysqldump: quick option
 
1525
.\" quick option: mysqldump
 
1526
\fB\-\-quick\fR,
 
1527
\fB\-q\fR
 
1528
.sp
 
1529
This option is useful for dumping large tables\&. It forces
 
1530
\fBmysqldump\fR
 
1531
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\&.
 
1532
.RE
 
1533
.sp
 
1534
.RS 4
 
1535
.ie n \{\
 
1536
\h'-04'\(bu\h'+03'\c
 
1537
.\}
 
1538
.el \{\
 
1539
.sp -1
 
1540
.IP \(bu 2.3
 
1541
.\}
 
1542
.\" mysqldump: print-defaults option
 
1543
.\" print-defaults option: mysqldump
 
1544
\fB\-\-print\-defaults\fR
 
1545
.sp
 
1546
Print the program argument list and exit\&. This must begiven as the first argument\&.
 
1547
.RE
 
1548
.sp
 
1549
.RS 4
 
1550
.ie n \{\
 
1551
\h'-04'\(bu\h'+03'\c
 
1552
.\}
 
1553
.el \{\
 
1554
.sp -1
 
1555
.IP \(bu 2.3
 
1556
.\}
 
1557
.\" mysqldump: quote-names option
 
1558
.\" quote-names option: mysqldump
 
1559
\fB\-\-quote\-names\fR,
 
1560
\fB\-Q\fR
 
1561
.sp
 
1562
Quote identifiers (such as database, table, and column names) within
 
1563
\(lq`\(rq
 
1564
characters\&. If the
 
1565
ANSI_QUOTES
 
1566
SQL mode is enabled, identifiers are quoted within
 
1567
\(lq"\(rq
 
1568
characters\&. This option is enabled by default\&. It can be disabled with
 
1569
\fB\-\-skip\-quote\-names\fR, but this option should be given after any option such as
 
1570
\fB\-\-compatible\fR
 
1571
that may enable
 
1572
\fB\-\-quote\-names\fR\&.
 
1573
.RE
 
1574
.sp
 
1575
.RS 4
 
1576
.ie n \{\
 
1577
\h'-04'\(bu\h'+03'\c
 
1578
.\}
 
1579
.el \{\
 
1580
.sp -1
 
1581
.IP \(bu 2.3
 
1582
.\}
 
1583
.\" mysqldump: replace option
 
1584
.\" replace option: mysqldump
 
1585
\fB\-\-replace\fR
 
1586
.sp
 
1587
Write
 
1588
REPLACE
 
1589
statements rather than
 
1590
INSERT
 
1591
statements\&. This option was added in MySQL 5\&.1\&.3\&.
 
1592
.RE
 
1593
.sp
 
1594
.RS 4
 
1595
.ie n \{\
 
1596
\h'-04'\(bu\h'+03'\c
 
1597
.\}
 
1598
.el \{\
 
1599
.sp -1
 
1600
.IP \(bu 2.3
 
1601
.\}
 
1602
.\" mysqldump: result-file option
 
1603
.\" result-file option: mysqldump
 
1604
\fB\-\-result\-file=\fR\fB\fIfile_name\fR\fR,
 
1605
\fB\-r \fR\fB\fIfile_name\fR\fR
 
1606
.sp
 
1607
Direct output to a given file\&. This option should be used on Windows to prevent newline
 
1608
\(lq\en\(rq
 
1609
characters from being converted to
 
1610
\(lq\er\en\(rq
 
1611
carriage return/newline sequences\&. The result file is created and its previous contents overwritten, even if an error occurs while generating the dump\&.
 
1612
.RE
 
1613
.sp
 
1614
.RS 4
 
1615
.ie n \{\
 
1616
\h'-04'\(bu\h'+03'\c
 
1617
.\}
 
1618
.el \{\
 
1619
.sp -1
 
1620
.IP \(bu 2.3
 
1621
.\}
 
1622
.\" mysqldump: routines option
 
1623
.\" routines option: mysqldump
 
1624
\fB\-\-routines\fR,
 
1625
\fB\-R\fR
 
1626
.sp
 
1627
Included stored routines (procedures and functions) for the dumped databases in the output\&. Use of this option requires the
 
1628
SELECT
 
1629
privilege for the
 
1630
mysql\&.proc
 
1631
table\&. The output generated by using
 
1632
\fB\-\-routines\fR
 
1633
contains
 
1634
CREATE PROCEDURE
 
1635
and
 
1636
CREATE FUNCTION
 
1637
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\&.
 
1638
.sp
 
1639
If you require routines to be re\-created with their original timestamp attributes, do not use
 
1640
\fB\-\-routines\fR\&. Instead, dump and reload the contents of the
 
1641
mysql\&.proc
 
1642
table directly, using a MySQL account that has appropriate privileges for the
 
1643
mysql
 
1644
database\&.
 
1645
.sp
 
1646
This option was added in MySQL 5\&.1\&.2\&. Before that, stored routines are not dumped\&. Routine
 
1647
DEFINER
 
1648
values are not dumped until MySQL 5\&.1\&.8\&. This means that before 5\&.1\&.8, when routines are reloaded, they will be created with the definer set to the reloading user\&. If you require routines to be re\-created with their original definer, dump and load the contents of the
 
1649
mysql\&.proc
 
1650
table directly as described earlier\&.
 
1651
.RE
 
1652
.sp
 
1653
.RS 4
 
1654
.ie n \{\
 
1655
\h'-04'\(bu\h'+03'\c
 
1656
.\}
 
1657
.el \{\
 
1658
.sp -1
 
1659
.IP \(bu 2.3
 
1660
.\}
 
1661
.\" mysqldump: set-charset option
 
1662
.\" set-charset option: mysqldump
 
1663
\fB\-\-set\-charset\fR
 
1664
.sp
 
1665
Add
 
1666
SET NAMES \fIdefault_character_set\fR
 
1667
to the output\&. This option is enabled by default\&. To suppress the
 
1668
SET NAMES
 
1669
statement, use
 
1670
\fB\-\-skip\-set\-charset\fR\&.
 
1671
.RE
 
1672
.sp
 
1673
.RS 4
 
1674
.ie n \{\
 
1675
\h'-04'\(bu\h'+03'\c
 
1676
.\}
 
1677
.el \{\
 
1678
.sp -1
 
1679
.IP \(bu 2.3
 
1680
.\}
 
1681
.\" mysqldump: single-transaction option
 
1682
.\" single-transaction option: mysqldump
 
1683
\fB\-\-single\-transaction\fR
 
1684
.sp
 
1685
This option sends a
 
1686
START TRANSACTION
 
1687
SQL statement to the server before dumping data\&. It is useful only with transactional tables such as
 
1688
InnoDB, because then it dumps the consistent state of the database at the time when
 
1689
BEGIN
 
1690
was issued without blocking any applications\&.
 
1691
.sp
 
1692
When using this option, you should keep in mind that only
 
1693
InnoDB
 
1694
tables are dumped in a consistent state\&. For example, any
 
1695
MyISAM
 
1696
or
 
1697
MEMORY
 
1698
tables dumped while using this option may still change state\&.
 
1699
.sp
 
1700
While a
 
1701
\fB\-\-single\-transaction\fR
 
1702
dump is in process, to ensure a valid dump file (correct table contents and binary log coordinates), no other connection should use the following statements:
 
1703
ALTER TABLE,
 
1704
CREATE TABLE,
 
1705
DROP TABLE,
 
1706
RENAME TABLE,
 
1707
TRUNCATE TABLE\&. A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause the
 
1708
SELECT
 
1709
that is performed by
 
1710
\fBmysqldump\fR
 
1711
to retrieve the table contents to obtain incorrect contents or fail\&.
 
1712
.sp
 
1713
The
 
1714
\fB\-\-single\-transaction\fR
 
1715
option and the
 
1716
\fB\-\-lock\-tables\fR
 
1717
option are mutually exclusive because
 
1718
LOCK TABLES
 
1719
causes any pending transactions to be committed implicitly\&.
 
1720
.sp
 
1721
This option is not supported for MySQL Cluster tables; the results cannot be guaranteed to be consistent due to the fact that the
 
1722
NDBCLUSTER
 
1723
storage engine supports only the
 
1724
READ_COMMITTED
 
1725
transaction isolation level\&. You should always use
 
1726
NDB
 
1727
backup and restore instead\&.
 
1728
.sp
 
1729
To dump large tables, you should combine the
 
1730
\fB\-\-single\-transaction\fR
 
1731
option with
 
1732
\fB\-\-quick\fR\&.
 
1733
.RE
 
1734
.sp
 
1735
.RS 4
 
1736
.ie n \{\
 
1737
\h'-04'\(bu\h'+03'\c
 
1738
.\}
 
1739
.el \{\
 
1740
.sp -1
 
1741
.IP \(bu 2.3
 
1742
.\}
 
1743
.\" mysqldump: skip-comments option
 
1744
.\" skip-comments option: mysqldump
 
1745
\fB\-\-skip\-comments\fR
 
1746
.sp
 
1747
See the description for the
 
1748
\fB\-\-comments\fR
 
1749
option\&.
 
1750
.RE
 
1751
.sp
 
1752
.RS 4
 
1753
.ie n \{\
 
1754
\h'-04'\(bu\h'+03'\c
 
1755
.\}
 
1756
.el \{\
 
1757
.sp -1
 
1758
.IP \(bu 2.3
 
1759
.\}
 
1760
.\" mysqldump: skip-opt option
 
1761
.\" skip-opt option: mysqldump
 
1762
\fB\-\-skip\-opt\fR
 
1763
.sp
 
1764
See the description for the
 
1765
\fB\-\-opt\fR
 
1766
option\&.
 
1767
.RE
 
1768
.sp
 
1769
.RS 4
 
1770
.ie n \{\
 
1771
\h'-04'\(bu\h'+03'\c
 
1772
.\}
 
1773
.el \{\
 
1774
.sp -1
 
1775
.IP \(bu 2.3
 
1776
.\}
 
1777
.\" mysqldump: socket option
 
1778
.\" socket option: mysqldump
 
1779
\fB\-\-socket=\fR\fB\fIpath\fR\fR,
 
1780
\fB\-S \fR\fB\fIpath\fR\fR
 
1781
.sp
 
1782
For connections to
 
1783
localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use\&.
 
1784
.RE
 
1785
.sp
 
1786
.RS 4
 
1787
.ie n \{\
 
1788
\h'-04'\(bu\h'+03'\c
 
1789
.\}
 
1790
.el \{\
 
1791
.sp -1
 
1792
.IP \(bu 2.3
 
1793
.\}
 
1794
.\" mysqldump: SSL options
 
1795
.\" SSL options: mysqldump
 
1796
\fB\-\-ssl*\fR
 
1797
.sp
 
1798
Options that begin with
 
1799
\fB\-\-ssl\fR
 
1800
specify whether to connect to the server via SSL and indicate where to find SSL keys and certificates\&. See
 
1801
Section\ \&5.5.6.3, \(lqSSL Command Options\(rq\&.
 
1802
.RE
 
1803
.sp
 
1804
.RS 4
 
1805
.ie n \{\
 
1806
\h'-04'\(bu\h'+03'\c
 
1807
.\}
 
1808
.el \{\
 
1809
.sp -1
 
1810
.IP \(bu 2.3
 
1811
.\}
 
1812
.\" mysqldump: tab option
 
1813
.\" tab option: mysqldump
 
1814
\fB\-\-tab=\fR\fB\fIpath\fR\fR,
 
1815
\fB\-T \fR\fB\fIpath\fR\fR
 
1816
.sp
 
1817
Produce tab\-separated text\-format data files\&. For each dumped table,
 
1818
\fBmysqldump\fR
 
1819
creates a
 
1820
\fItbl_name\fR\&.sql
 
1821
file that contains the
 
1822
CREATE TABLE
 
1823
statement that creates the table, and the server writes a
 
1824
\fItbl_name\fR\&.txt
 
1825
file that contains its data\&. The option value is the directory in which to write the files\&.
 
1826
.if n \{\
 
1827
.sp
 
1828
.\}
 
1829
.RS 4
 
1830
.it 1 an-trap
 
1831
.nr an-no-space-flag 1
 
1832
.nr an-break-flag 1
 
1833
.br
 
1834
.ps +1
 
1835
\fBNote\fR
 
1836
.ps -1
 
1837
.br
 
1838
This option should be used only when
 
1839
\fBmysqldump\fR
 
1840
is run on the same machine as the
 
1841
\fBmysqld\fR
 
1842
server\&. You must have the
 
1843
FILE
 
1844
privilege, and the server must have permission to write files in the directory that you specify\&.
 
1845
.sp .5v
 
1846
.RE
 
1847
By default, the
 
1848
\&.txt
 
1849
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
 
1850
\fB\-\-fields\-\fR\fB\fIxxx\fR\fR
 
1851
and
 
1852
\fB\-\-lines\-terminated\-by\fR
 
1853
options\&.
 
1854
.sp
 
1855
As of MySQL 5\&.1\&.38, column values are converted to the character set specified by the
 
1856
\fB\-\-default\-character\-set\fR
 
1857
option\&. Prior to 5\&.1\&.38 or if no such option is present, values are dumped using the
 
1858
binary
 
1859
character set\&. 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\&.
 
1860
.RE
 
1861
.sp
 
1862
.RS 4
 
1863
.ie n \{\
 
1864
\h'-04'\(bu\h'+03'\c
 
1865
.\}
 
1866
.el \{\
 
1867
.sp -1
 
1868
.IP \(bu 2.3
 
1869
.\}
 
1870
.\" mysqldump: tables option
 
1871
.\" tables option: mysqldump
 
1872
\fB\-\-tables\fR
 
1873
.sp
 
1874
Override the
 
1875
\fB\-\-databases\fR
 
1876
or
 
1877
\fB\-B\fR
 
1878
option\&.
 
1879
\fBmysqldump\fR
 
1880
regards all name arguments following the option as table names\&.
 
1881
.RE
 
1882
.sp
 
1883
.RS 4
 
1884
.ie n \{\
 
1885
\h'-04'\(bu\h'+03'\c
 
1886
.\}
 
1887
.el \{\
 
1888
.sp -1
 
1889
.IP \(bu 2.3
 
1890
.\}
 
1891
.\" mysqldump: triggers option
 
1892
.\" triggers option: mysqldump
 
1893
\fB\-\-triggers\fR
 
1894
.sp
 
1895
Include triggers for each dumped table in the output\&. This option is enabled by default; disable it with
 
1896
\fB\-\-skip\-triggers\fR\&.
 
1897
.RE
 
1898
.sp
 
1899
.RS 4
 
1900
.ie n \{\
 
1901
\h'-04'\(bu\h'+03'\c
 
1902
.\}
 
1903
.el \{\
 
1904
.sp -1
 
1905
.IP \(bu 2.3
 
1906
.\}
 
1907
.\" mysqldump: tz-utc option
 
1908
.\" tz-utc option: mysqldump
 
1909
\fB\-\-tz\-utc\fR
 
1910
.sp
 
1911
This option enables
 
1912
TIMESTAMP
 
1913
columns to be dumped and reloaded between servers in different time zones\&.
 
1914
\fBmysqldump\fR
 
1915
sets its connection time zone to UTC and adds
 
1916
SET TIME_ZONE=\'+00:00\'
 
1917
to the dump file\&. Without this option,
 
1918
TIMESTAMP
 
1919
columns are dumped and reloaded in the time zones local to the source and destination servers, which can cause the values to change if the servers are in different time zones\&.
 
1920
\fB\-\-tz\-utc\fR
 
1921
also protects against changes due to daylight saving time\&.
 
1922
\fB\-\-tz\-utc\fR
 
1923
is enabled by default\&. To disable it, use
 
1924
\fB\-\-skip\-tz\-utc\fR\&. This option was added in MySQL 5\&.1\&.2\&.
 
1925
.RE
 
1926
.sp
 
1927
.RS 4
 
1928
.ie n \{\
 
1929
\h'-04'\(bu\h'+03'\c
 
1930
.\}
 
1931
.el \{\
 
1932
.sp -1
 
1933
.IP \(bu 2.3
 
1934
.\}
 
1935
.\" mysqldump: user option
 
1936
.\" user option: mysqldump
 
1937
\fB\-\-user=\fR\fB\fIuser_name\fR\fR,
 
1938
\fB\-u \fR\fB\fIuser_name\fR\fR
 
1939
.sp
 
1940
The MySQL user name to use when connecting to the server\&.
 
1941
.RE
 
1942
.sp
 
1943
.RS 4
 
1944
.ie n \{\
 
1945
\h'-04'\(bu\h'+03'\c
 
1946
.\}
 
1947
.el \{\
 
1948
.sp -1
 
1949
.IP \(bu 2.3
 
1950
.\}
 
1951
.\" mysqldump: verbose option
 
1952
.\" verbose option: mysqldump
 
1953
\fB\-\-verbose\fR,
 
1954
\fB\-v\fR
 
1955
.sp
 
1956
Verbose mode\&. Print more information about what the program does\&.
 
1957
.RE
 
1958
.sp
 
1959
.RS 4
 
1960
.ie n \{\
 
1961
\h'-04'\(bu\h'+03'\c
 
1962
.\}
 
1963
.el \{\
 
1964
.sp -1
 
1965
.IP \(bu 2.3
 
1966
.\}
 
1967
.\" mysqldump: version option
 
1968
.\" version option: mysqldump
 
1969
\fB\-\-version\fR,
 
1970
\fB\-V\fR
 
1971
.sp
 
1972
Display version information and exit\&.
 
1973
.RE
 
1974
.sp
 
1975
.RS 4
 
1976
.ie n \{\
 
1977
\h'-04'\(bu\h'+03'\c
 
1978
.\}
 
1979
.el \{\
 
1980
.sp -1
 
1981
.IP \(bu 2.3
 
1982
.\}
 
1983
.\" mysqldump: where option
 
1984
.\" where option: mysqldump
 
1985
\fB\-\-where=\'\fR\fB\fIwhere_condition\fR\fR\fB\'\fR,
 
1986
\fB\-w \'\fR\fB\fIwhere_condition\fR\fR\fB\'\fR
 
1987
.sp
 
1988
Dump only rows selected by the given
 
1989
WHERE
 
1990
condition\&. Quotes around the condition are mandatory if it contains spaces or other characters that are special to your command interpreter\&.
 
1991
.sp
 
1992
Examples:
 
1993
.sp
 
1994
.if n \{\
 
1995
.RS 4
 
1996
.\}
 
1997
.nf
 
1998
\-\-where="user=\'jimf\'"
 
1999
\-w"userid>1"
 
2000
\-w"userid<1"
 
2001
.fi
 
2002
.if n \{\
 
2003
.RE
 
2004
.\}
 
2005
.RE
 
2006
.sp
 
2007
.RS 4
 
2008
.ie n \{\
 
2009
\h'-04'\(bu\h'+03'\c
 
2010
.\}
 
2011
.el \{\
 
2012
.sp -1
 
2013
.IP \(bu 2.3
 
2014
.\}
 
2015
.\" mysqldump: xml option
 
2016
.\" xml option: mysqldump
 
2017
\fB\-\-xml\fR,
 
2018
\fB\-X\fR
 
2019
.sp
 
2020
Write dump output as well\-formed XML\&.
 
2021
.sp
 
2022
\fBNULL\fR\fB, \fR\fB\'NULL\'\fR\fB, and Empty Values\fR: For a column named
 
2023
\fIcolumn_name\fR, the
 
2024
NULL
 
2025
value, an empty string, and the string value
 
2026
\'NULL\'
 
2027
are distinguished from one another in the output generated by this option as follows\&.
 
2028
.TS
 
2029
allbox tab(:);
 
2030
l lx.
 
2031
T{
 
2032
\fBValue\fR:
 
2033
T}:T{
 
2034
\fBXML Representation\fR:
 
2035
T}
 
2036
T{
 
2037
NULL (\fIunknown value\fR)
 
2038
T}:T{
 
2039
<field name="\fIcolumn_name\fR" xsi:nil="true" />
 
2040
T}
 
2041
T{
 
2042
\'\' (\fIempty string\fR)
 
2043
T}:T{
 
2044
<field name="\fIcolumn_name\fR">\:</field>
 
2045
T}
 
2046
T{
 
2047
\'NULL\' (\fIstring value\fR)
 
2048
T}:T{
 
2049
<field name="\fIcolumn_name\fR">\:NULL</field>
 
2050
T}
 
2051
.TE
 
2052
.sp 1
 
2053
Beginning with MySQL 5\&.1\&.12, the output from the
 
2054
\fBmysql\fR
 
2055
client when run using the
 
2056
\fB\-\-xml\fR
 
2057
option also follows the preceding rules\&. (See
 
2058
the section called \(lqMYSQL OPTIONS\(rq\&.)
 
2059
.sp
 
2060
Beginning with MySQL 5\&.1\&.18, XML output from
 
2061
\fBmysqldump\fR
 
2062
includes the XML namespace, as shown here:
 
2063
.sp
 
2064
.if n \{\
 
2065
.RS 4
 
2066
.\}
 
2067
.nf
 
2068
shell> \fBmysqldump \-\-xml \-u root world City\fR
 
2069
<?xml version="1\&.0"?>
 
2070
<mysqldump xmlns:xsi="http://www\&.w3\&.org/2001/XMLSchema\-instance">
 
2071
<database name="world">
 
2072
<table_structure name="City">
 
2073
<field Field="ID" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" />
 
2074
<field Field="Name" Type="char(35)" Null="NO" Key="" Default="" Extra="" />
 
2075
<field Field="CountryCode" Type="char(3)" Null="NO" Key="" Default="" Extra="" />
 
2076
<field Field="District" Type="char(20)" Null="NO" Key="" Default="" Extra="" />
 
2077
<field Field="Population" Type="int(11)" Null="NO" Key="" Default="0" Extra="" />
 
2078
<key Table="City" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="ID"
 
2079
Collation="A" Cardinality="4079" Null="" Index_type="BTREE" Comment="" />
 
2080
<options Name="City" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="4079"
 
2081
Avg_row_length="67" Data_length="273293" Max_data_length="18858823439613951"
 
2082
Index_length="43008" Data_free="0" Auto_increment="4080"
 
2083
Create_time="2007\-03\-31 01:47:01" Update_time="2007\-03\-31 01:47:02"
 
2084
Collation="latin1_swedish_ci" Create_options="" Comment="" />
 
2085
</table_structure>
 
2086
<table_data name="City">
 
2087
<row>
 
2088
<field name="ID">1</field>
 
2089
<field name="Name">Kabul</field>
 
2090
<field name="CountryCode">AFG</field>
 
2091
<field name="District">Kabol</field>
 
2092
<field name="Population">1780000</field>
 
2093
</row>
 
2094
\fI\&.\&.\&.\fR
 
2095
<row>
 
2096
<field name="ID">4079</field>
 
2097
<field name="Name">Rafah</field>
 
2098
<field name="CountryCode">PSE</field>
 
2099
<field name="District">Rafah</field>
 
2100
<field name="Population">92020</field>
 
2101
</row>
 
2102
</table_data>
 
2103
</database>
 
2104
</mysqldump>
 
2105
.fi
 
2106
.if n \{\
 
2107
.RE
 
2108
.\}
 
2109
.sp
 
2110
.RE
 
2111
.PP
 
2112
You can also set the following variables by using
 
2113
\fB\-\-\fR\fB\fIvar_name\fR\fR\fB=\fR\fB\fIvalue\fR\fR
 
2114
syntax:
 
2115
.sp
 
2116
.RS 4
 
2117
.ie n \{\
 
2118
\h'-04'\(bu\h'+03'\c
 
2119
.\}
 
2120
.el \{\
 
2121
.sp -1
 
2122
.IP \(bu 2.3
 
2123
.\}
 
2124
max_allowed_packet
 
2125
.sp
 
2126
The maximum size of the buffer for client/server communication\&. The maximum is 1GB\&.
 
2127
.RE
 
2128
.sp
 
2129
.RS 4
 
2130
.ie n \{\
 
2131
\h'-04'\(bu\h'+03'\c
 
2132
.\}
 
2133
.el \{\
 
2134
.sp -1
 
2135
.IP \(bu 2.3
 
2136
.\}
 
2137
net_buffer_length
 
2138
.sp
 
2139
The initial size of the buffer for client/server communication\&. When creating multiple\-row
 
2140
INSERT
 
2141
statements (as with the
 
2142
\fB\-\-extended\-insert\fR
 
2143
or
 
2144
\fB\-\-opt\fR
 
2145
option),
 
2146
\fBmysqldump\fR
 
2147
creates rows up to
 
2148
net_buffer_length
 
2149
length\&. If you increase this variable, you should also ensure that the
 
2150
net_buffer_length
 
2151
variable in the MySQL server is at least this large\&.
 
2152
.RE
 
2153
.PP
 
2154
A common use of
 
2155
\fBmysqldump\fR
 
2156
is for making a backup of an entire database:
 
2157
.sp
 
2158
.if n \{\
 
2159
.RS 4
 
2160
.\}
 
2161
.nf
 
2162
shell> \fBmysqldump \fR\fB\fIdb_name\fR\fR\fB > \fR\fB\fIbackup\-file\&.sql\fR\fR
 
2163
.fi
 
2164
.if n \{\
 
2165
.RE
 
2166
.\}
 
2167
.PP
 
2168
You can load the dump file back into the server like this:
 
2169
.sp
 
2170
.if n \{\
 
2171
.RS 4
 
2172
.\}
 
2173
.nf
 
2174
shell> \fBmysql \fR\fB\fIdb_name\fR\fR\fB < \fR\fB\fIbackup\-file\&.sql\fR\fR
 
2175
.fi
 
2176
.if n \{\
 
2177
.RE
 
2178
.\}
 
2179
.PP
 
2180
Or like this:
 
2181
.sp
 
2182
.if n \{\
 
2183
.RS 4
 
2184
.\}
 
2185
.nf
 
2186
shell> \fBmysql \-e "source \fR\fB\fI/path\-to\-backup/backup\-file\&.sql\fR\fR\fB" \fR\fB\fIdb_name\fR\fR
 
2187
.fi
 
2188
.if n \{\
 
2189
.RE
 
2190
.\}
 
2191
.PP
 
2192
\fBmysqldump\fR
 
2193
is also very useful for populating databases by copying data from one MySQL server to another:
 
2194
.sp
 
2195
.if n \{\
 
2196
.RS 4
 
2197
.\}
 
2198
.nf
 
2199
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
 
2200
.fi
 
2201
.if n \{\
 
2202
.RE
 
2203
.\}
 
2204
.PP
 
2205
It is possible to dump several databases with one command:
 
2206
.sp
 
2207
.if n \{\
 
2208
.RS 4
 
2209
.\}
 
2210
.nf
 
2211
shell> \fBmysqldump \-\-databases \fR\fB\fIdb_name1\fR\fR\fB [\fR\fB\fIdb_name2\fR\fR\fB \&.\&.\&.] > my_databases\&.sql\fR
 
2212
.fi
 
2213
.if n \{\
 
2214
.RE
 
2215
.\}
 
2216
.PP
 
2217
To dump all databases, use the
 
2218
\fB\-\-all\-databases\fR
 
2219
option:
 
2220
.sp
 
2221
.if n \{\
 
2222
.RS 4
 
2223
.\}
 
2224
.nf
 
2225
shell> \fBmysqldump \-\-all\-databases > all_databases\&.sql\fR
 
2226
.fi
 
2227
.if n \{\
 
2228
.RE
 
2229
.\}
 
2230
.PP
 
2231
For
 
2232
InnoDB
 
2233
tables,
 
2234
\fBmysqldump\fR
 
2235
provides a way of making an online backup:
 
2236
.sp
 
2237
.if n \{\
 
2238
.RS 4
 
2239
.\}
 
2240
.nf
 
2241
shell> \fBmysqldump \-\-all\-databases \-\-single\-transaction > all_databases\&.sql\fR
 
2242
.fi
 
2243
.if n \{\
 
2244
.RE
 
2245
.\}
 
2246
.PP
 
2247
This backup acquires a global read lock on all tables (using
 
2248
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
 
2249
FLUSH
 
2250
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\&.
 
2251
.PP
 
2252
For point\-in\-time recovery (also known as
 
2253
\(lqroll\-forward,\(rq
 
2254
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
 
2255
Section\ \&5.2.4, \(lqThe Binary Log\(rq) or at least know the binary log coordinates to which the dump corresponds:
 
2256
.sp
 
2257
.if n \{\
 
2258
.RS 4
 
2259
.\}
 
2260
.nf
 
2261
shell> \fBmysqldump \-\-all\-databases \-\-master\-data=2 > all_databases\&.sql\fR
 
2262
.fi
 
2263
.if n \{\
 
2264
.RE
 
2265
.\}
 
2266
.PP
 
2267
Or:
 
2268
.sp
 
2269
.if n \{\
 
2270
.RS 4
 
2271
.\}
 
2272
.nf
 
2273
shell> \fBmysqldump \-\-all\-databases \-\-flush\-logs \-\-master\-data=2\fR
 
2274
              \fB> all_databases\&.sql\fR
 
2275
.fi
 
2276
.if n \{\
 
2277
.RE
 
2278
.\}
 
2279
.PP
 
2280
The
 
2281
\fB\-\-master\-data\fR
 
2282
and
 
2283
\fB\-\-single\-transaction\fR
 
2284
options can be used simultaneously, which provides a convenient way to make an online backup suitable for use prior to point\-in\-time recovery if tables are stored using the
 
2285
InnoDB
 
2286
storage engine\&.
 
2287
.PP
 
2288
For more information on making backups, see
 
2289
Section\ \&6.2, \(lqDatabase Backup Methods\(rq, and
 
2290
Section\ \&6.3, \(lqExample Backup and Recovery Strategy\(rq\&.
 
2291
.\" mysqldump: views
 
2292
.\" mysqldump: problems
 
2293
.\" mysqldump: workarounds
 
2294
.PP
 
2295
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
 
2296
Section\ \&D.4, \(lqRestrictions on Views\(rq\&.
 
2297
.SH "COPYRIGHT"
 
2298
.br
 
2299
.PP
 
2300
Copyright 2007-2008 MySQL AB, 2008-2010 Sun Microsystems, Inc.
 
2301
.PP
 
2302
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.
 
2303
.PP
 
2304
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.
 
2305
.PP
 
2306
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/.
 
2307
.sp
 
2308
.SH "NOTES"
 
2309
.IP " 1." 4
 
2310
Bug#30123
 
2311
.RS 4
 
2312
\%http://bugs.mysql.com/bug.php?id=30123
 
2313
.RE
 
2314
.SH "SEE ALSO"
 
2315
For more information, please refer to the MySQL Reference Manual,
 
2316
which may already be installed locally and which is also available
 
2317
online at http://dev.mysql.com/doc/.
 
2318
.SH AUTHOR
 
2319
Sun Microsystems, Inc. (http://www.mysql.com/).