码迷,mamicode.com
首页 > 数据库 > 详细

MySQL系列之F-2------mysqldump -help

时间:2015-07-13 01:05:52      阅读:243      评论:0      收藏:0      [点我收藏+]

标签:mysqldump

[root@mysql01 ~]# mysqldump --help

mysqldump  Ver 10.13 Distrib 5.6.24, for linux-glibc2.5(x86_64)

Copyright (c) 2000, 2015, Oracle and/orits affiliates. All rights reserved.

 

Oracle is a registered trademark ofOracle Corporation and/or its

affiliates. Other names may betrademarks of their respective

owners.

Oracle是甲骨文公司的注册商标和/或其附属机构。

其他名称可能是其各自所有者的商标。

 

Dumping structure and contents of MySQLdatabases and tables.

Usage: mysqldump [OPTIONS] database[tables]

OR    mysqldump [OPTIONS] --databases [OPTIONS] DB1 [DB2 DB3...]

OR    mysqldump [OPTIONS] --all-databases [OPTIONS]

 

Default options are read from thefollowing files in the given order:

/etc/my.cnf /etc/mysql/my.cnf/usr/local/mysql/etc/my.cnf ~/.my.cnf

The following groups are read:mysqldump client

The following options may be given asthe first argument:

--print-defaults        Print the program argument list andexit.

--no-defaults           Don‘t read default options from anyoption file,

                        except for login file.

--defaults-file=#       Only read default options from the givenfile #.

--defaults-extra-file=# Read this fileafter the global files are read.

--defaults-group-suffix=#

                        Also read groups withconcat(group, suffix)

--login-path=#          Read this path from the login file.

 -A, --all-databases Dump all the databases. This will be same as--databases

                      with all databasesselected.

 -Y, --all-tablespaces

                      Dump all the tablespaces.

 -y, --no-tablespaces

                      Do not dump anytablespace information.

  --add-drop-database Add a DROP DATABASE beforeeach create.

 --add-drop-table    Add a DROPTABLE before each create.

                      (Defaults to on; use--skip-add-drop-table to disable.)

 --add-drop-trigger  Add a DROPTRIGGER before each create.

 --add-locks         Add locksaround INSERT statements.

                      (Defaults to on; use--skip-add-locks to disable.)

 --allow-keywords    Allow creationof column names that are keywords.

 --apply-slave-statements

                      Adds ‘STOP SLAVE‘ priorto ‘CHANGE MASTER‘ and ‘START

                      SLAVE‘ to bottom of dump.

 --bind-address=name IP address to bind to.

 --character-sets-dir=name

                      Directory for characterset files.

 -i, --comments      Writeadditional information.

                      (Defaults to on; use--skip-comments to disable.)

 --compatible=name   Change thedump to be compatible with a given mode. By

                      default tables are dumpedin a format optimized for

                     MySQL. Legalmodes are: ansi, mysql323, mysql40,

                      postgresql, oracle,mssql, db2, maxdb, no_key_options,

                      no_table_options,no_field_options. One can use several

                      modes separated bycommas. Note: Requires MySQL server

                      version 4.1.0 or higher.This option is ignored with

                      earlier server versions.

 --compact           Give lessverbose output (useful for debugging). Disables

                      structure comments and header/footerconstructs.  Enables

                      options--skip-add-drop-table --skip-add-locks

                      --skip-comments--skip-disable-keys --skip-set-charset.

 -c, --complete-insert

                      Use complete insert statements.

 -C, --compress      Usecompression in server/client protocol.

 -a, --create-options

                      Include all MySQLspecific create options.

                      (Defaults to on; use--skip-create-options to disable.)

 -B, --databases     Dump severaldatabases. Note the difference in usage; in

                      this case no tables aregiven. All name arguments are

                      regarded as databasenames. ‘USE db_name;‘ will be

                      included in the output.

 -#, --debug[=#]     This is anon-debug version. Catch this and exit.

 --debug-check       Check memoryand open file usage at exit.

 --debug-info        Print somedebug info at exit.

 --default-character-set=name

                     Set thedefault character set.

 --delayed-insert    Insert rowswith INSERT DELAYED.

 --delete-master-logs

                      Delete logs on masterafter backup. This automatically

                      enables --master-data.

 -K, --disable-keys  ‘/*!40000ALTER TABLE tb_name DISABLE KEYS */; and

                      ‘/*!40000 ALTER TABLEtb_name ENABLE KEYS */; will be put

                      in the output.

                      (Defaults to on; use--skip-disable-keys to disable.)

 --dump-slave[=#]    This causesthe binary log position and filename of the

                      master to be appended tothe dumped data output. Setting

                      the value to 1, willprintit as a CHANGE MASTER command

                      in the dumped data output; if equal to2, that command

                      will be prefixed with acomment symbol. This option will

                      turn --lock-all-tableson, unless --single-transaction is

                      specified too (in whichcase a global read lock is only

                      taken a short time at thebeginning of the dump - don‘t

                      forget to read about--single-transaction below). In all

                      cases any action on logswill happen at the exact moment

                      of the dump.Optionautomatically turns --lock-tables off.

 -E, --events        Dump events.

 -e, --extended-insert

                      Use multiple-row INSERTsyntax that include several

                      VALUES lists.

                      (Defaults to on; use--skip-extended-insert to disable.)

 --fields-terminated-by=name

                      Fields in the output fileare terminated by the given

                      string.

 --fields-enclosed-by=name

                      Fields in the output fileare enclosed by the given

                      character.

 --fields-optionally-enclosed-by=name

                      Fields in the output fileare optionally enclosed by the

                      given character.

 --fields-escaped-by=name

                      Fields in the output fileare escaped by the given

                      character.

 -F, --flush-logs    Flush logsfile in server before starting dump. Note that

                      if you dump manydatabases at once (using the option

                      --databases= or--all-databases), the logs will be

                      flushed for each databasedumped. The exception is when

                      using --lock-all-tablesor --master-data: in this case

                      the logs will be flushedonly once, corresponding to the

                      moment all tables arelocked. So if you want your dump

                      and the log flush tohappen at the same exact moment you

                      should use--lock-all-tables or --master-data with

                      --flush-logs.

 --flush-privileges  Emit a FLUSHPRIVILEGES statement after dumping the mysql

                      database.  This option should be used any time the dump

                      contains the mysqldatabase and any other database that

                      depends on the data inthe mysql database for proper

                      restore.

 -f, --force         Continue evenif we get an SQL error.

  -?, --help          Display this help message and exit.

 --hex-blob          Dump binarystrings (BINARY, VARBINARY, BLOB) in

                      hexadecimal format.

 -h, --host=name     Connect tohost.

 --ignore-table=name Do not dump the specified table. To specify morethan one

                      table to ignore, use thedirective multiple times, once

                      for each table.  Each table must be specified with both

                      database and table names,e.g.,

                      --ignore-table=database.table.

 --include-master-host-port

                      Adds‘MASTER_HOST=<host>, MASTER_PORT=<port>‘ to ‘CHANGE

                      MASTER TO..‘ in dumpproduced with --dump-slave.

 --insert-ignore     Insert rows withINSERT IGNORE.

 --lines-terminated-by=name

                      Lines in the output fileare terminated by the given

                      string.

 -x, --lock-all-tables

                      Locks all tables acrossall databases. This is achieved

                      by taking a global readlock for the duration of the

                      whole dump. Automaticallyturns --single-transaction and

                      --lock-tables off.

 -l, --lock-tables   Lock alltables for read.

                      (Defaults to on; use--skip-lock-tables to disable.)

 --log-error=name    Appendwarnings and errors to given file.

 --master-data[=#]   This causesthe binary log position and filename to be

                      appended to the output.If equal to 1, will print it as a

                      CHANGE MASTER command; ifequal to 2, that command will

                      be prefixed with acomment symbol. This option will turn

                      --lock-all-tables on,unless --single-transaction is

                      specified too (in whichcase a global read lock is only

                      taken a short time at thebeginning of the dump; don‘t

                      forget to read about--single-transaction below). In all

                      cases, any action on logs will happen at theexact moment

                      of the dump. Optionautomatically turns --lock-tables

                      off.

 --max-allowed-packet=#

                      The maximum packet lengthto send to or receive from

                      server.

 --net-buffer-length=#

                      The buffer size forTCP/IP and socket communication.

 --no-autocommit     Wrap tableswith autocommit/commit statements.

 -n, --no-create-db  Suppress theCREATE DATABASE ... IF EXISTS statement that

                      normally is output foreach dumped database if

                      --all-databases or--databases is given.

 -t, --no-create-info

                      Don‘t write tablecreation info.

 -d, --no-data       No rowinformation.

 -N, --no-set-names  Same as--skip-set-charset.

 --opt               Same as--add-drop-table, --add-locks, --create-options,

                      --quick,--extended-insert, --lock-tables, --set-charset,

                      and --disable-keys. Enabled by default,disable with

                      --skip-opt.

 --order-by-primary  Sorts eachtable‘s rows by primary key, or first unique

                      key, if such a keyexists.  Useful when dumping a MyISAM

                     table to be loadedinto an InnoDB table, but will make

                      the dump itself takeconsiderably longer.

 -p, --password[=name]

                      Password to use whenconnecting to server. If password is

                      not given it‘s solicited on the tty.

 -P, --port=#        Port number touse for connection.

 --protocol=name     The protocolto use for connection (tcp, socket, pipe,

                      memory).

 -q, --quick         Don‘t bufferquery, dump directly to stdout.

                      (Defaults to on; use--skip-quick to disable.)

 -Q, --quote-names   Quote tableand column names with backticks (`).

                      (Defaults to on; use--skip-quote-names to disable.)

 --replace           Use REPLACEINTO instead of INSERT INTO.

 -r, --result-file=name

                      Direct output to a givenfile. This option should be used

                      in systems (e.g., DOS,Windows) that use carriage-return

                      linefeed pairs (\r\n) toseparate text lines. This option

                      ensures that only asingle newline is used.

 -R, --routines      Dump storedroutines (functions and procedures).

 --set-charset       Add ‘SET NAMESdefault_character_set‘ to the output.

                      (Defaults to on; use--skip-set-charset to disable.)

 --set-gtid-purged[=name]

                      Add ‘SET@@GLOBAL.GTID_PURGED‘ to the output. Possible

                      values for this optionare ON, OFF and AUTO. If ON is

                      used and GTIDs are notenabled on the server, an error is

                      generated. If OFF isused, this option does nothing. If

                      AUTO is used and GTIDsare enabled on the server, ‘SET

                      @@GLOBAL.GTID_PURGED‘ is added to theoutput. If GTIDs

                      are disabled, AUTO doesnothing. If no value is supplied

                      then the default (AUTO)value will be considered.

 --single-transaction

                      Creates a consistent snapshot by dumping alltables in a

                      single transaction. WorksONLY for tables stored in

                      storage engines whichsupport multiversioning (currently

                      only InnoDB does); the dumpis NOT guaranteed to be

                      consistent for otherstorage engines. While a

                      --single-transaction dumpis in process, to ensure a

                      valid dump file (correcttable contents and binary log

                     position), no otherconnection should use the following

                      statements: ALTER TABLE,DROP TABLE, RENAME TABLE,

                      TRUNCATE TABLE, asconsistent snapshot is not isolated

                      from them. Optionautomatically turns off --lock-tables.

 --dump-date         Put a dumpdate to the end of the output.

                      (Defaults to on; use--skip-dump-date to disable.)

 --skip-opt          Disable --opt.Disables --add-drop-table, --add-locks,

                      --create-options,--quick, --extended-insert,

                      --lock-tables,--set-charset, and --disable-keys.

 -S, --socket=name   The socketfile to use for connection.

 --secure-auth       Refuse clientconnecting to server if it uses old

                      (pre-4.1.1) protocol.

                      (Defaults to on; use--skip-secure-auth to disable.)

 --ssl               Enable SSL forconnection (automatically enabled with

                      other flags).

 --ssl-ca=name       CA file in PEMformat (check OpenSSL docs, implies

                      --ssl).

 --ssl-capath=name   CA directory(check OpenSSL docs, implies --ssl).

 --ssl-cert=name     X509 cert inPEM format (implies --ssl).

 --ssl-cipher=name   SSL cipher touse (implies --ssl).

 --ssl-key=name      X509 key inPEM format (implies --ssl).

 --ssl-crl=name      Certificaterevocation list (implies --ssl).

 --ssl-crlpath=name  Certificaterevocation list path (implies --ssl).

 --ssl-verify-server-cert

                      Verify server‘s"Common Name" in its cert against

                      hostname used whenconnecting. This option is disabled by

                      default.

 -T, --tab=name      Createtab-separated textfile for each table to given

                      path. (Create .sql and.txt files.) NOTE: This only works

                      if mysqldump is run onthe same machine as the mysqld

                      server.

 --tables            Overridesoption --databases (-B).

 --triggers          Dump triggersfor each dumped table.

                      (Defaults to on; use--skip-triggers to disable.)

 --tz-utc            SETTIME_ZONE=‘+00:00‘ at top of dump to allow dumping of

                      TIMESTAMP data when aserver has data in different time

                      zones or data is beingmoved between servers with

                      different time zones.

                      (Defaults to on; use--skip-tz-utc to disable.)

 -u, --user=name     User for loginif not current user.

 -v, --verbose       Print infoabout the various stages.

 -V, --version       Output versioninformation and exit.

 -w, --where=name    Dump onlyselected records. Quotes are mandatory.

 -X, --xml           Dump adatabase as well formed XML.

 --plugin-dir=name   Directory forclient-side plugins.

 --default-auth=name Default authentication client-side plugin to use.

 

Variables (--variable-name=value)

and boolean options {FALSE|TRUE}  Value (after reading options)

-------------------------------------------------------------------------

all-databases                     FALSE

all-tablespaces                   FALSE

no-tablespaces                    FALSE

add-drop-database                 FALSE

add-drop-table                    TRUE

add-drop-trigger                  FALSE

add-locks                         TRUE

allow-keywords                    FALSE

apply-slave-statements            FALSE

bind-address                      (No default value)

character-sets-dir                (No default value)

comments                          TRUE

compatible                        (No default value)

compact                           FALSE

complete-insert                   FALSE

compress                          FALSE

create-options                    TRUE

databases                         FALSE

debug-check                       FALSE

debug-info                        FALSE

default-character-set             utf8

delayed-insert                    FALSE

delete-master-logs                FALSE

disable-keys                      TRUE

dump-slave                        0

events                            FALSE

extended-insert                   TRUE

fields-terminated-by              (No default value)

fields-enclosed-by                (No default value)

fields-optionally-enclosed-by     (No default value)

fields-escaped-by                 (No default value)

flush-logs                        FALSE

flush-privileges                  FALSE

force                             FALSE

hex-blob                          FALSE

host                              (No defaultvalue)

include-master-host-port          FALSE

insert-ignore                     FALSE

lines-terminated-by               (No default value)

lock-all-tables                   FALSE

lock-tables                       TRUE

log-error                         (No default value)

master-data                       0

max-allowed-packet                25165824

net-buffer-length                 1046528

no-autocommit                     FALSE

no-create-db                      FALSE

no-create-info                    FALSE

no-data                           FALSE

order-by-primary                  FALSE

port                              0

quick                             TRUE

quote-names                       TRUE

replace                           FALSE

routines                          FALSE

set-charset                       TRUE

single-transaction                FALSE

dump-date                         TRUE

socket                            (No default value)

secure-auth                       TRUE

ssl                               FALSE

ssl-ca                            (No default value)

ssl-capath                        (No default value)

ssl-cert                          (No default value)

ssl-cipher                        (No default value)

ssl-key                           (No default value)

ssl-crl                           (No default value)

ssl-crlpath                       (No default value)

ssl-verify-server-cert            FALSE

tab                               (No defaultvalue)

triggers                          TRUE

tz-utc                            TRUE

user                              (No defaultvalue)

verbose                           FALSE

where                             (No default value)

plugin-dir                        (No default value)

default-auth                      (No default value)


本文出自 “技术博” 博客,请务必保留此出处http://hostman.blog.51cto.com/6303208/1673516

MySQL系列之F-2------mysqldump -help

标签:mysqldump

原文地址:http://hostman.blog.51cto.com/6303208/1673516

(0)
(0)
   
举报
评论 一句话评论(0
登录后才能评论!
© 2014 mamicode.com 版权所有  联系我们:gaon5@hotmail.com
迷上了代码!