MYSQLDUMP(1) MySQL Database System MYSQLDUMP(1)

2
3
4

NAME

6       mysqldump - a database backup program
7

SYNOPSIS

9       mysqldump [options] [db_name [tbl_name ...]]
10

DESCRIPTION

12       The mysqldump client is a backup program originally written by Igor
13       Romanenko. It can be used to dump a database or a collection of
14       databases for backup or transfer to another SQL server (not necessarily
15       a MySQL server). The dump typically contains SQL statements to create
16       the table, populate it, or both. However, mysqldump can also be used to
17       generate files in CSV, other delimited text, or XML format.
18
19       If you are doing a backup on the server and your tables all are MyISAM
20       tables, consider using the mysqlhotcopy instead because it can
21       accomplish faster backups and faster restores. See mysqlhotcopy(1).
22
23       There are three general ways to invoke mysqldump:
24
25          shell> mysqldump [options] db_name [tables]
26          shell> mysqldump [options] --databases db_name1 [db_name2 db_name3...]
27          shell> mysqldump [options] --all-databases
28
29       If you do not name any tables following db_name or if you use the
30       --databases or --all-databases option, entire databases are dumped.
31
32       To get a list of the options your version of mysqldump supports,
33       execute mysqldump --help.
34
35       Some mysqldump options are shorthand for groups of other options.
36       --opt and --compact fall into this category. For example, use of --opt
37       is the same as specifying --add-drop-table --add-locks --create-options
38       --disable-keys --extended-insert --lock-tables --quick --set-charset.
39       Note that all of the options that --opt stands for also are on by
40       default because --opt is on by default.
41
42       To reverse the effect of a group option, uses its --skip-xxx form
43       (--skip-opt or --skip-compact). It is also possible to select only part
44       of the effect of a group option by following it with options that
45       enable or disable specific features. Here are some examples:
46
47       ·  To select the effect of --opt except for some features, use the
48          --skip option for each feature. For example, to disable extended
49          inserts and memory buffering, use --opt --skip-extended-insert
50          --skip-quick. (As of MySQL 5.0, --skip-extended-insert --skip-quick
51          is sufficient because --opt is on by default.)
52
53       ·  To reverse --opt for all features except index disabling and table
54          locking, use --skip-opt --disable-keys --lock-tables.
55
56
57       When you selectively enable or disable the effect of a group option,
58       order is important because options are processed first to last. For
59       example, --disable-keys --lock-tables --skip-opt would not have the
60       intended effect; it is the same as --skip-opt by itself.
61
62       mysqldump can retrieve and dump table contents row by row, or it can
63       retrieve the entire content from a table and buffer it in memory before
64       dumping it. Buffering in memory can be a problem if you are dumping
65       large tables. To dump tables row by row, use the --quick option (or
66       --opt, which enables --quick).  --opt (and hence --quick) is enabled by
67       default as of MySQL 5.0 to enable memory buffering, use --skip-quick.
68
69       If you are using a recent version of mysqldump to generate a dump to be
70       reloaded into a very old MySQL server, you should not use the --opt or
71       --extended-insert option. Use --skip-opt instead.
72
73       Before MySQL 4.1.2, out-of-range numeric values such as -inf and inf,
74       as well as NaN (not-a-number) values are dumped by mysqldump as NULL.
75       You can see this using the following sample table:
76
77          mysql> CREATE TABLE t (f DOUBLE);
78          mysql> INSERT INTO t VALUES(1e+111111111111111111111);
79          mysql> INSERT INTO t VALUES(-1e111111111111111111111);
80          mysql> SELECT f FROM t;
81          +------+
82          | f    |
83          +------+
84          |  inf |
85          | -inf |
86          +------+
87
88       For this table, mysqldump produces the following data output:
89
90          --
91          -- Dumping data for table `t`
92          --
93          INSERT INTO t VALUES (NULL);
94          INSERT INTO t VALUES (NULL);
95
96       The significance of this behavior is that if you dump and restore the
97       table, the new table has contents that differ from the original
98       contents. This problem is fixed as of MySQL 4.1.2; you cannot insert
99       inf in the table, so this mysqldump behavior is only relevant when you
100       deal with old servers.
101
102       mysqldump supports the following options:
103
104       ·  --help, -?
105
106          Display a help message and exit.
107
108       ·  --add-drop-database
109
110          Add a DROP DATABASE statement before each CREATE DATABASE statement.
111
112       ·  --add-drop-table
113
114          Add a DROP TABLE statement before each CREATE TABLE statement.
115
116       ·  --add-locks
117
118          Surround each table dump with LOCK TABLES and UNLOCK TABLES
119          statements. This results in faster inserts when the dump file is
120          reloaded. See Section 2.17, “Speed of INSERT Statements”.
121
122       ·  --all-databases, -A
123
124          Dump all tables in all databases. This is the same as using the
125          --databases option and naming all the databases on the command line.
126
127       ·  --allow-keywords
128
129          Allow creation of column names that are keywords. This works by
130          prefixing each column name with the table name.
131
132       ·  --character-sets-dir=path
133
134          The directory where character sets are installed. See Section 8.1,
135          “The Character Set Used for Data and Sorting”.
136
137       ·  --comments, -i
138
139          Write additional information in the dump file such as program
140          version, server version, and host. This option is enabled by
141          default. To suppress this additional information, use
142          --skip-comments.
143
144       ·  --compact
145
146          Produce less verbose output. This option suppresses comments and
147          enables the --skip-add-drop-table, --skip-set-charset,
148          --skip-disable-keys, and --skip-add-locks options.
149
150       ·  --compatible=name
151
152          Produce output that is more compatible with other database systems
153          or with older MySQL servers. The value of name can be ansi,
154          mysql323, mysql40, postgresql, oracle, mssql, db2, maxdb,
155          no_key_options, no_table_options, or no_field_options. To use
156          several values, separate them by commas. These values have the same
157          meaning as the corresponding options for setting the server SQL
158          mode. See the section called “SQL MODES”.
159
160          This option does not guarantee compatibility with other servers. It
161          only enables those SQL mode values that are currently available for
162          making dump output more compatible. For example, --compatible=oracle
163          does not map data types to Oracle types or use Oracle comment
164          syntax.
165
166          This option requires a server version of 4.1.0 or higher. With older
167          servers, it does nothing.
168
169       ·  --complete-insert, -c
170
171          Use complete INSERT statements that include column names.
172
173       ·  --compress, -C
174
175          Compress all information sent between the client and the server if
176          both support compression.
177
178       ·  --create-options
179
180          Include all MySQL-specific table options in the CREATE TABLE
181          statements.
182
183       ·  --databases, -B
184
185          Dump several databases. Normally, mysqldump treats the first name
186          argument on the command line as a database name and following names
187          as table names. With this option, it treats all name arguments as
188          database names.  CREATE DATABASE and USE statements are included in
189          the output before each new database.
190
191       ·  --debug[=debug_options], -# [debug_options]
192
193          Write a debugging log. The debug_options string is often
194          ´d:t:o,file_name'. The default value is
195          ´d:t:o,/tmp/mysqldump.trace'.
196
197       ·  --default-character-set=charset_name
198
199          Use charset_name as the default character set. See Section 8.1, “The
200          Character Set Used for Data and Sorting”. If no character set is
201          specified, mysqldump uses utf8, and earlier versions use latin1.
202
203       ·  --delayed-insert
204
205          Write INSERT DELAYED statements rather than INSERT statements.
206
207       ·  --delete-master-logs
208
209          On a master replication server, delete the binary logs after
210          performing the dump operation. This option automatically enables
211          --master-data.
212
213       ·  --disable-keys, -K
214
215          For each table, surround the INSERT statements with /*!40000 ALTER
216          TABLE tbl_name DISABLE KEYS */; and /*!40000 ALTER TABLE tbl_name
217          ENABLE KEYS */; statements. This makes loading the dump file faster
218          because the indexes are created after all rows are inserted. This
219          option is effective only for non-unique indexes of MyISAM tables.
220
221       ·  --extended-insert, -e
222
223          Use multiple-row INSERT syntax that include several VALUES lists.
224          This results in a smaller dump file and speeds up inserts when the
225          file is reloaded.
226
227       ·  --fields-terminated-by=..., --fields-enclosed-by=...,
228          --fields-optionally-enclosed-by=..., --fields-escaped-by=...
229
230          These options are used with the -T option and have the same meaning
231          as the corresponding clauses for LOAD DATA INFILE. See Section 2.5,
232          “LOAD DATA INFILE Syntax”.
233
234       ·  --first-slave, -x
235
236          Deprecated. Now renamed to --lock-all-tables.
237
238       ·  --flush-logs, -F
239
240          Flush the MySQL server log files before starting the dump. This
241          option requires the RELOAD privilege. Note that if you use this
242          option in combination with the --all-databases (or -A) option, the
243          logs are flushed for each database dumped. The exception is when
244          using --lock-all-tables or --master-data: In this case, the logs are
245          flushed only once, corresponding to the moment that all tables are
246          locked. If you want your dump and the log flush to happen at exactly
247          the same moment, you should use --flush-logs together with either
248          --lock-all-tables or --master-data.
249
250       ·  --flush-privileges
251
252          Emit a FLUSH PRIVILEGES statement after dumping the mysql database.
253          This option should be used any time the dump contains the mysql
254          database and any other database that depends on the data in the
255          mysql database for proper restoration. This option was added in
256          MySQL 5.0.26.
257
258       ·  --force, -f
259
260          Continue even if an SQL error occurs during a table dump.
261
262          One use for this option is to cause mysqldump to continue executing
263          even when it encounters a view that has become invalid because the
264          defintion refers to a table that has been dropped. Without --force,
265          mysqldump exits with an error message. With --force, mysqldump
266          prints the error message, but it also writes a SQL comment
267          containing the view definition to the dump output and continues
268          executing.
269
270       ·  --host=host_name, -h host_name
271
272          Dump data from the MySQL server on the given host. The default host
273          is localhost.
274
275       ·  --hex-blob
276
277          Dump binary columns using hexadecimal notation (for example, ´abc'
278          becomes 0x616263). The affected data types are BINARY, VARBINARY,
279          and BLOB. As of MySQL 5.0.13, BIT columns are affected as well.
280
281       ·  --ignore-table=db_name.tbl_name
282
283          Do not dump the given table, which must be specified using both the
284          database and table names. To ignore multiple tables, use this option
285          multiple times.
286
287       ·  --insert-ignore
288
289          Write INSERT statements with the IGNORE option.
290
291       ·  --lines-terminated-by=...
292
293          This option is used with the -T option and has the same meaning as
294          the corresponding clause for LOAD DATA INFILE. See Section 2.5,
295          “LOAD DATA INFILE Syntax”.
296
297       ·  --lock-all-tables, -x
298
299          Lock all tables across all databases. This is achieved by acquiring
300          a global read lock for the duration of the whole dump. This option
301          automatically turns off --single-transaction and --lock-tables.
302
303       ·  --lock-tables, -l
304
305          Lock all tables before dumping them. The tables are locked with READ
306          LOCAL to allow concurrent inserts in the case of MyISAM tables. For
307          transactional tables such as InnoDB and BDB, --single-transaction is
308          a much better option, because it does not need to lock the tables at
309          all.
310
311          Please note that when dumping multiple databases, --lock-tables
312          locks tables for each database separately. Therefore, this option
313          does not guarantee that the tables in the dump file are logically
314          consistent between databases. Tables in different databases may be
315          dumped in completely different states.
316
317       ·  --master-data[=value]
318
319          Write the binary log filename and position to the output. This
320          option requires the RELOAD privilege and the binary log must be
321          enabled. If the option value is equal to 1, the position and
322          filename are written to the dump output in the form of a CHANGE
323          MASTER statement. If the dump is from a master server and you use it
324          to set up a slave server, the CHANGE MASTER statement causes the
325          slave to start from the correct position in the master's binary
326          logs. If the option value is equal to 2, the CHANGE MASTER statement
327          is written as an SQL comment. (This is the default action if value
328          is omitted.)
329
330          The --master-data option automatically turns off --lock-tables. It
331          also turns on --lock-all-tables, unless --single-transaction also is
332          specified (in which case, a global read lock is acquired only for a
333          short time at the beginning of the dump. See also the description
334          for --single-transaction. In all cases, any action on logs happens
335          at the exact moment of the dump.
336
337       ·  --no-autocommit
338
339          Enclose the INSERT statements for each dumped table within SET
340          AUTOCOMMIT=0 and COMMIT statements.
341
342       ·  --no-create-db, -n
343
344          This option suppresses the CREATE DATABASE statements that are
345          otherwise included in the output if the --databases or
346          --all-databases option is given.
347
348       ·  --no-create-info, -t
349
350          Do not write CREATE TABLE statements that re-create each dumped
351          table.
352
353       ·  --no-data, -d
354
355          Do not write any table row information (that is, do not dump table
356          contents). This is very useful if you want to dump only the CREATE
357          TABLE statement for the table.
358
359       ·  --opt
360
361          This option is shorthand; it is the same as specifying
362          --add-drop-table --add-locks --create-options --disable-keys
363          --extended-insert --lock-tables --quick --set-charset. It should
364          give you a fast dump operation and produce a dump file that can be
365          reloaded into a MySQL server quickly.
366
367          The --opt option is enabled by default. Use --skip-opt to disable
368          it.  See the discussion at the beginning of this section for
369          information about selectively enabling or disabling certain of the
370          options affected by --opt.
371
372       ·  --order-by-primary
373
374          Sorts each table's rows by its primary key, or by its first unique
375          index, if such an index exists. This is useful when dumping a MyISAM
376          table to be loaded into an InnoDB table, but will make the dump
377          itself take considerably longer.
378
379       ·  --password[=password], -p[password]
380
381          The password to use when connecting to the server. If you use the
382          short option form (-p), you cannot have a space between the option
383          and the password. If you omit the password value following the
384          --password or -p option on the command line, you are prompted for
385          one.
386
387          Specifying a password on the command line should be considered
388          insecure. See Section 6.6, “Keeping Your Password Secure”.
389
390       ·  --port=port_num, -P port_num
391
392          The TCP/IP port number to use for the connection.
393
394       ·  --protocol={TCP|SOCKET|PIPE|MEMORY}
395
396          The connection protocol to use.
397
398       ·  --quick, -q
399
400          This option is useful for dumping large tables. It forces mysqldump
401          to retrieve rows for a table from the server a row at a time rather
402          than retrieving the entire row set and buffering it in memory before
403          writing it out.
404
405       ·  --quote-names, -Q
406
407          Quote database, table, and column names within ‘`’ characters. If
408          the ANSI_QUOTES SQL mode is enabled, names are quoted within ‘"’
409          characters. This option is enabled by default. It can be disabled
410          with --skip-quote-names, but this option should be given after any
411          option such as --compatible that may enable --quote-names.
412
413       ·  --result-file=file, -r file
414
415          Direct output to a given file. This option should be used on Windows
416          to prevent newline ‘\n’ characters from being converted to ‘\r\n’
417          carriage return/newline sequences. The result file is created and
418          its contents overwritten, even if an error occurs while generating
419          the dump. The previous contents are lost.
420
421       ·  --routines, -R
422
423          Dump stored routines (functions and procedures) from the dumped
424          databases. Use of this option requires the SELECT privilege for the
425          mysql.proc table. The output generated by using --routines contains
426          CREATE PROCEDURE and CREATE FUNCTION statements to re-create the
427          routines. However, these statements do not include attributes such
428          as the routine creation and modification timestamps. This means that
429          when the routines are reloaded, they will be created with the
430          timestamps equal to the reload time.
431
432          If you require routines to be re-created with their original
433          timestamp attributes, do not use --routines. Instead, dump and
434          reload the contents of the mysql.proc table directly, using a MySQL
435          account that has appropriate privileges for the mysql database.
436
437          This option was added in MySQL 5.0.13. Before that, stored routines
438          are not dumped. Routine DEFINER values are not dumped until MySQL
439          5.0.20. This means that before 5.0.20, when routines are reloaded,
440          they will be created with the definer set to the reloading user. If
441          you require routines to be re-created with their original definer,
442          dump and load the contents of the mysql.proc table directly as
443          described earlier.
444
445       ·  --set-charset
446
447          Add SET NAMES default_character_set to the output. This option is
448          enabled by default. To suppress the SET NAMES statement, use
449          --skip-set-charset.
450
451       ·  --single-transaction
452
453          This option issues a BEGIN SQL statement before dumping data from
454          the server. It is useful only with transactional tables such as
455          InnoDB and BDB, because then it dumps the consistent state of the
456          database at the time when BEGIN was issued without blocking any
457          applications.
458
459          When using this option, you should keep in mind that only InnoDB
460          tables are dumped in a consistent state. For example, any MyISAM or
461          MEMORY tables dumped while using this option may still change state.
462
463          The --single-transaction option and the --lock-tables option are
464          mutually exclusive, because LOCK TABLES causes any pending
465          transactions to be committed implicitly.
466
467          This option is not supported for MySQL Cluster tables; the results
468          cannot be guaranteed to be consistent due to the fact that the
469          NDBCluster storage engine supports only the READ_COMMITTED
470          transaction isolation level. You should always use NDB backup and
471          restore instead.
472
473          To dump large tables, you should combine this option with --quick.
474
475       ·  --skip-opt
476
477          See the description for the --opt option.
478
479       ·  --socket=path, -S path
480
481          For connections to localhost, the Unix socket file to use, or, on
482          Windows, the name of the named pipe to use.
483
484       ·  --skip-comments
485
486          See the description for the --comments option.
487
488       ·  --ssl*
489
490          Options that begin with --ssl specify whether to connect to the
491          server via SSL and indicate where to find SSL keys and certificates.
492          See Section 6.7.3, “SSL Command Options”.
493
494       ·  --tab=path, -T path
495
496          Produce tab-separated data files. For each dumped table, mysqldump
497          creates a tbl_name.sql file that contains the CREATE TABLE statement
498          that creates the table, and a tbl_name.txt file that contains its
499          data. The option value is the directory in which to write the files.
500
501          By default, the .txt data files are formatted using tab characters
502          between column values and a newline at the end of each line. The
503          format can be specified explicitly using the --fields-xxx and
504          --lines-terminated-by options.
505
506          Note: This option should be used only when mysqldump is run on the
507          same machine as the mysqld server. You must have the FILE privilege,
508          and the server must have permission to write files in the directory
509          that you specify.
510
511       ·  --tables
512
513          Override the --databases or -B option.  mysqldump regards all name
514          arguments following the option as table names.
515
516       ·  --triggers
517
518          Dump triggers for each dumped table. This option is enabled by
519          default; disable it with --skip-triggers. This option was added in
520          MySQL 5.0.11. Before that, triggers are not dumped.
521
522       ·  --tz-utc
523
524          Add SET TIME_ZONE='+00:00' to the dump file so that TIMESTAMP
525          columns can be dumped and reloaded between servers in different time
526          zones. Without this option, TIMESTAMP columns are dumped and
527          reloaded in the time zones local to the source and destination
528          servers, which can cause the values to change.  --tz-utc also
529          protects against changes due to daylight saving time.  --tz-utc is
530          enabled by default. To disable it, use --skip-tz-utc. This option
531          was added in MySQL 5.0.15.
532
533       ·  --user=user_name, -u user_name
534
535          The MySQL username to use when connecting to the server.
536
537       ·  --verbose, -v
538
539          Verbose mode. Print more information about what the program does.
540
541       ·  --version, -V
542
543          Display version information and exit.
544
545       ·  --where='where_condition', -w 'where_condition'
546
547          Dump only rows selected by the given WHERE condition. Quotes around
548          the condition are mandatory if it contains spaces or other
549          characters that are special to your command interpreter.
550
551          Examples:
552
553          --where="user='jimf'"
554          -w"userid>1"
555          -w"userid<1"
556
557       ·  --xml, -X
558
559          Write dump output as well-formed XML.
560
561          NULL, 'NULL', and Empty Values: For some column named column_name,
562          the NULL value, an empty string, and the string value ´NULL' are
563          distinguished from one another in the output generated by this
564          option as follows:
565
566          ┌──────────────────────┬───────────────────────────────────────────────────────┐
567Value:                │ XML Representation:                                   │
568          ├──────────────────────┼───────────────────────────────────────────────────────┤
569          │NULL (unknown value)  │ <field name="column_name"                             │
570          │                      │                       xsi:nil="true"                  │
571          │                      │ />                                                    │
572          ├──────────────────────┼───────────────────────────────────────────────────────┤
573          │´' (empty string)     │ <field                                                │
574          │                      │                       name="column_name"></field>     │
575          ├──────────────────────┼───────────────────────────────────────────────────────┤
576          │´NULL' (string value) │ <field                                                │
577          │                      │                       name="column_name">NULL</field> │
578          └──────────────────────┴───────────────────────────────────────────────────────┘
579          Beginning with MySQL 5.0.26, the output from the mysql client when
580          run using the --xml option also follows these rules. (See the
581          section called “MYSQL OPTIONS”.)
582
583          Beginning with MySQL 5.0.40, XML output from mysqldump includes the
584          XML namespace, as shown here:
585
586          shell> mysqldump --xml -u root world City
587          <?xml version="1.0"?>
588          <mysqldump xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">
589          <database name="world">
590          <table_structure name="City">
591          <field Field="ID" Type="int(11)" Null="NO" Key="PRI" Extra="auto_increment" />
592          <field Field="Name" Type="char(35)" Null="NO" Key="" Default="" Extra="" />
593          <field Field="CountryCode" Type="char(3)" Null="NO" Key="" Default="" Extra="" />
594          <field Field="District" Type="char(20)" Null="NO" Key="" Default="" Extra="" />
595          <field Field="Population" Type="int(11)" Null="NO" Key="" Default="0" Extra="" />
596          <key Table="City" Non_unique="0" Key_name="PRIMARY" Seq_in_index="1" Column_name="ID" Collation="A" Cardinality="4079"
597          Null="" Index_type="BTREE" Comment="" />
598          <options Name="City" Engine="MyISAM" Version="10" Row_format="Fixed" Rows="4079" Avg_row_length="67" Data_length="27329
599          3" Max_data_length="18858823439613951" Index_length="43008" Data_free="0" Auto_increment="4080" Create_time="2007-03-31 01:47:01" Updat
600          e_time="2007-03-31 01:47:02" Collation="latin1_swedish_ci" Create_options="" Comment="" />
601          </table_structure>
602          <table_data name="City">
603          <row>
604          <field name="ID">1</field>
605          <field name="Name">Kabul</field>
606          <field name="CountryCode">AFG</field>
607          <field name="District">Kabol</field>
608          <field name="Population">1780000</field>
609          </row>
610          ...
611          <row>
612          <field name="ID">4079</field>
613          <field name="Name">Rafah</field>
614          <field name="CountryCode">PSE</field>
615          <field name="District">Rafah</field>
616          <field name="Population">92020</field>
617          </row>
618          </table_data>
619          </database>
620          </mysqldump>
621
622
623
624       You can also set the following variables by using --var_name=value
625       syntax:
626
627       ·  max_allowed_packet
628
629          The maximum size of the buffer for client/server communication. The
630          maximum is 1GB.
631
632       ·  net_buffer_length
633
634          The initial size of the buffer for client/server communication. When
635          creating multiple-row-insert statements (as with option
636          --extended-insert or --opt), mysqldump creates rows up to
637          net_buffer_length length. If you increase this variable, you should
638          also ensure that the net_buffer_length variable in the MySQL server
639          is at least this large.
640
641
642       It is also possible to set variables by using
643       --set-variable=var_name=value or -O var_name=value syntax.  This syntax
644       is deprecated.
645
646       The most common use of mysqldump is probably for making a backup of an
647       entire database:
648
649          shell> mysqldump db_name > backup-file.sql
650
651       You can read the dump file back into the server like this:
652
653          shell> mysql db_name < backup-file.sql
654
655       Or like this:
656
657          shell> mysql -e "source /path-to-backup/backup-file.sql" db_name
658
659       mysqldump is also very useful for populating databases by copying data
660       from one MySQL server to another:
661
662          shell> mysqldump --opt db_name | mysql --host=remote_host -C db_name
663
664       It is possible to dump several databases with one command:
665
666          shell> mysqldump --databases db_name1 [db_name2 ...] > my_databases.sql
667
668       To dump all databases, use the --all-databases option:
669
670          shell> mysqldump --all-databases > all_databases.sql
671
672       For InnoDB tables, mysqldump provides a way of making an online backup:
673
674          shell> mysqldump --all-databases --single-transaction > all_databases.sql
675
676       This backup just needs to acquire a global read lock on all tables
677       (using FLUSH TABLES WITH READ LOCK) at the beginning of the dump. As
678       soon as this lock has been acquired, the binary log coordinates are
679       read and the lock is released. If and only if one long updating
680       statement is running when the FLUSH statement is issued, the MySQL
681       server may get stalled until that long statement finishes, and then the
682       dump becomes lock-free. If the update statements that the MySQL server
683       receives are short (in terms of execution time), the initial lock
684       period should not be noticeable, even with many updates.
685
686       For point-in-time recovery (also known as “roll-forward,” when you need
687       to restore an old backup and replay the changes that happened since
688       that backup), it is often useful to rotate the binary log (see
689       Section 9.3, “The Binary Log”) or at least know the binary log
690       coordinates to which the dump corresponds:
691
692          shell> mysqldump --all-databases --master-data=2 > all_databases.sql
693
694       Or:
695
696          shell> mysqldump --all-databases --flush-logs --master-data=2
697                        > all_databases.sql
698
699       The --master-data and --single-transaction options can be used
700       simultaneously, which provides a convenient way to make an online
701       backup suitable for point-in-time recovery if tables are stored using
702       the InnoDB storage engine.
703
704       For more information on making backups, see Section 7.1, “Database
705       Backups”, and Section 7.2, “Example Backup and Recovery Strategy”.
706
707       If you encounter problems backing up views, please read the section
708       that covers restrictions on views which describes a workaround for
709       backing up views when this fails due to insufficient privileges. See
710       Section 4, “Restrictions on Views”.
711
713       Copyright 1997-2007 MySQL AB
714
715       This documentation is NOT distributed under a GPL license. Use of this
716       documentation is subject to the following terms: You may create a
717       printed copy of this documentation solely for your own personal use.
718       Conversion to other formats is allowed as long as the actual content is
719       not altered or edited in any way. You shall not publish or distribute
720       this documentation in any form or on any media, except if you
721       distribute the documentation in a manner similar to how MySQL
722       disseminates it (that is, electronically for download on a Web site
723       with the software) or on a CD-ROM or similar medium, provided however
724       that the documentation is disseminated together with the software on
725       the same medium. Any other use, such as any dissemination of printed
726       copies or use of this documentation, in whole or in part, in another
727       publication, requires the prior written consent from an authorized
728       representative of MySQL AB. MySQL AB reserves any and all rights to
729       this documentation not expressly granted above.
730
731       Please email <docs@mysql.com> for more information.
732

SEE ALSO

734       For more information, please refer to the MySQL Reference Manual, which
735       may already be installed locally and which is also available online at
736       http://dev.mysql.com/doc/.
737

AUTHOR

739       MySQL AB (http://www.mysql.com/).  This software comes with no
740       warranty.
741
742
743
744MySQL 5.0                         07/04/2007                      MYSQLDUMP(1)
Impressum