Linux "mysqlpump" Command Line Options and Examples
a database backup program

· mysqlpump Invocation Syntax · mysqlpump Option Summary · mysqlpump Option Descriptions · mysqlpump Object Selection · mysqlpump Parallel Processing · mysqlpump Restrictions The mysqlpump client utility performs logical backups, producing a set of SQL statements that can be executed to reproduce the original database object definitions and table data.


Usage:

mysqlpump [options] [db_name [tbl_name ...]]




Command Line Options:

--help
Display a help message and exit.
mysqlpump --help ...
--add-drop-database
Write a DROP DATABASE statement before each CREATE DATABASE statement.
mysqlpump --add-drop-database ...
--add-drop-table
Write a DROP TABLE statement before each CREATE TABLE statement.
mysqlpump --add-drop-table ...
--add-drop-user
Write a DROP USER statement before each CREATE USER statement.
mysqlpump --add-drop-user ...
--add-locks
Surround each table dump with LOCK TABLES and UNLOCK TABLES statements. This results in faster inserts when the dump file isreloaded. See Section 8.2.5.1, “Optimizing INSERT Statements”.This option does not work with parallelism because INSERT statements from different tables can be interleaved and UNLOCK TABLESfollowing the end of the inserts for one table could release locks on tables for which inserts remain.
mysqlpump --add-locks ...
--all-databases
Dump all databases (with certain exceptions noted in mysqlpump Restrictions). This is the default behavior if no other isspecified explicitly.
mysqlpump --all-databases ...
--bind-address
On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQLserver.
mysqlpump --bind-address ...
--character-sets-dir
The directory where character sets are installed. See Section 10.15, “Character Set Configuration”.
mysqlpump --character-sets-dir ...
--complete-insert
Write complete INSERT statements that include column names.
mysqlpump --complete-insert ...
--compress
Compress all information sent between the client and the server if possible. See Section 4.2.6, “Connection Compression Control”.As of MySQL 8.0.18, this option is deprecated. It will be removed in a future MySQL version. See the section called “LegacyConnection Compression Configuration”.
mysqlpump --compress ...
--compress-output
By default, mysqlpump does not compress output. This option specifies output compression using the specified algorithm. Permittedalgorithms are LZ4 and ZLIB.To uncompress compressed output, you must have an appropriate utility. If the system commands lz4 and openssl zlib are notavailable, MySQL distributions include lz4_decompress and zlib_decompress utilities that can be used to decompress mysqlpumpoutput that was compressed using the --compress-output=LZ4 and --compress-output=ZLIB options. For more information, seelz4_decompress(1), and zlib_decompress(1).
mysqlpump --compress-output ...
--databases
Normally, mysqlpump treats the first name argument on the command line as a database name and any following names as table names.With this option, it treats all name arguments as database names. CREATE DATABASE statements are included in the output beforeeach new database.
mysqlpump --databases ...
--debug[
Write a debugging log. A typical debug_options string is d:t:o,file_name. The default is d:t:O,/tmp/mysqlpump.trace.
mysqlpump --debug[ ...
--debug-check
Print some debugging information when the program exits.
mysqlpump --debug-check ...
--debug-info
Print debugging information and memory and CPU usage statistics when the program exits.
mysqlpump --debug-info ...
--default-auth
A hint about which client-side authentication plugin to use. See Section 6.2.17, “Pluggable Authentication”.
mysqlpump --default-auth ...
--default-character-set
Use charset_name as the default character set. See Section 10.15, “Character Set Configuration”. If no character set isspecified, mysqlpump uses utf8.
mysqlpump --default-character-set ...
--default-parallelism
The default number of threads for each parallel processing queue. The default is 2.The --parallel-schemas option also affects parallelism and can be used to override the default number of threads. For moreinformation, see mysqlpump Parallel Processing.With --default-parallelism=0 and no --parallel-schemas options, mysqlpump runs as a single-threaded process and creates noqueues.With parallelism enabled, it is possible for output from different databases to be interleaved.
mysqlpump --default-parallelism ...
--defaults-extra-file
Read this option file after the global option file but (on Unix) before the user option file. If the file does not exist or isotherwise inaccessible, an error occurs. file_name is interpreted relative to the current directory if given as a relative pathname rather than a full path name.For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that AffectOption-File Handling”.
mysqlpump --defaults-extra-file ...
--defaults-file
Use only the given option file. If the file does not exist or is otherwise inaccessible, an error occurs. file_name isinterpreted relative to the current directory if given as a relative path name rather than a full path name.Exception: Even with --defaults-file, client programs read .mylogin.cnf.For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that AffectOption-File Handling”.
mysqlpump --defaults-file ...
--defaults-group-suffix
Read not only the usual option groups, but also groups with the usual names and a suffix of str. For example, mysqlpump normallyreads the [client] and [mysqlpump] groups. If the --defaults-group-suffix=_other option is given, mysqlpump also reads the[client_other] and [mysqlpump_other] groups.For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that AffectOption-File Handling”.
mysqlpump --defaults-group-suffix ...
--defer-table-indexes
In the dump output, defer index creation for each table until after its rows have been loaded. This works for all storageengines, but for InnoDB applies only for secondary indexes.This option is enabled by default; use --skip-defer-table-indexes to disable it.
mysqlpump --defer-table-indexes ...
--events
Include Event Scheduler events for the dumped databases in the output. Event dumping requires the EVENT privileges for thosedatabases.The output generated by using --events contains CREATE EVENT statements to create the events.This option is enabled by default; use --skip-events to disable it.
mysqlpump --events ...
--exclude-databases
Do not dump the databases in db_list, which is a list of one or more comma-separated database names. Multiple instances of thisoption are additive. For more information, see mysqlpump Object Selection.
mysqlpump --exclude-databases ...
--exclude-events
Do not dump the databases in event_list, which is a list of one or more comma-separated event names. Multiple instances of thisoption are additive. For more information, see mysqlpump Object Selection.
mysqlpump --exclude-events ...
--exclude-routines
Do not dump the events in routine_list, which is a list of one or more comma-separated routine (stored procedure or function)names. Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.
mysqlpump --exclude-routines ...
--exclude-tables
Do not dump the tables in table_list, which is a list of one or more comma-separated table names. Multiple instances of thisoption are additive. For more information, see mysqlpump Object Selection.
mysqlpump --exclude-tables ...
--exclude-triggers
Do not dump the triggers in trigger_list, which is a list of one or more comma-separated trigger names. Multiple instances ofthis option are additive. For more information, see mysqlpump Object Selection.
mysqlpump --exclude-triggers ...
--exclude-users
Do not dump the user accounts in user_list, which is a list of one or more comma-separated account names. Multiple instances ofthis option are additive. For more information, see mysqlpump Object Selection.
mysqlpump --exclude-users ...
--extended-insert
Write INSERT statements using multiple-row syntax that includes several VALUES lists. This results in a smaller dump file andspeeds up inserts when the file is reloaded.The option value indicates the number of rows to include in each INSERT statement. The default is 250. A value of 1 produces oneINSERT statement per table row.
mysqlpump --extended-insert ...
--get-server-public-key
Request from the server the public key required for RSA key pair-based password exchange. This option applies to clients thatauthenticate with the caching_sha2_password authentication plugin. For that plugin, the server does not send the public keyunless requested. This option is ignored for accounts that do not authenticate with that plugin. It is also ignored if RSA-basedpassword exchange is not used, as is the case when the client connects to the server using a secure connection.If --server-public-key-path=file_name is given and specifies a valid public key file, it takes precedence over
mysqlpump --get-server-public-key ...
--get-server-public-key.
For information about the caching_sha2_password plugin, see Section 6.4.1.3, “Caching SHA-2 Pluggable Authentication”.
mysqlpump --get-server-public-key. ...
--hex-blob
Dump binary columns using hexadecimal notation (for example, 'abc' becomes 0x616263). The affected data types are BINARY,VARBINARY, BLOB types, BIT, all spatial data types, and other non-binary data types when used with the binary character set.
mysqlpump --hex-blob ...
--host
Dump data from the MySQL server on the given host.
mysqlpump --host ...
--include-databases
Dump the databases in db_list, which is a list of one or more comma-separated database names. The dump includes all objects inthe named databases. Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.
mysqlpump --include-databases ...
--include-events
Dump the events in event_list, which is a list of one or more comma-separated event names. Multiple instances of this option areadditive. For more information, see mysqlpump Object Selection.
mysqlpump --include-events ...
--include-routines
Dump the routines in routine_list, which is a list of one or more comma-separated routine (stored procedure or function) names.Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.
mysqlpump --include-routines ...
--include-tables
Dump the tables in table_list, which is a list of one or more comma-separated table names. Multiple instances of this option areadditive. For more information, see mysqlpump Object Selection.
mysqlpump --include-tables ...
--include-triggers
Dump the triggers in trigger_list, which is a list of one or more comma-separated trigger names. Multiple instances of thisoption are additive. For more information, see mysqlpump Object Selection.
mysqlpump --include-triggers ...
--include-users
Dump the user accounts in user_list, which is a list of one or more comma-separated user names. Multiple instances of this optionare additive. For more information, see mysqlpump Object Selection.
mysqlpump --include-users ...
--insert-ignore
Write INSERT IGNORE statements rather than INSERT statements.
mysqlpump --insert-ignore ...
--log-error-file
Log warnings and errors by appending them to the named file. If this option is not given, mysqlpump writes warnings and errors tothe standard error output.
mysqlpump --log-error-file ...
--login-path
Read options from the named login path in the .mylogin.cnf login path file. A “login path” is an option group containing optionsthat specify which MySQL server to connect to and which account to authenticate as. To create or modify a login path file, usethe mysql_config_editor utility. See mysql_config_editor(1).For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that AffectOption-File Handling”.
mysqlpump --login-path ...
--max-allowed-packet
The maximum size of the buffer for client/server communication. The default is 24MB, the maximum is 1GB.
mysqlpump --max-allowed-packet ...
--net-buffer-length
The initial size of the buffer for client/server communication. When creating multiple-row INSERT statements (as with the
mysqlpump --net-buffer-length ...
--no-create-db
Suppress any CREATE DATABASE statements that might otherwise be included in the output.
mysqlpump --no-create-db ...
--no-create-info
Do not write CREATE TABLE statements that create each dumped table.
mysqlpump --no-create-info ...
--no-defaults
Do not read any option files. If program startup fails due to reading unknown options from an option file, --no-defaults can beused to prevent them from being read.The exception is that the .mylogin.cnf file, if it exists, is read in all cases. This permits passwords to be specified in asafer way than on the command line even when --no-defaults is used. (.mylogin.cnf is created by the mysql_config_editor utility.See mysql_config_editor(1).)For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that AffectOption-File Handling”.
mysqlpump --no-defaults ...
--parallel-schemas
Create a queue for processing the databases in db_list, which is a list of one or more comma-separated database names. If N isgiven, the queue uses N threads. If N is not given, the --default-parallelism option determines the number of queue threads.Multiple instances of this option create multiple queues. mysqlpump also creates a default queue to use for databases not namedin any --parallel-schemas option, and for dumping user definitions if command options select them. For more information, seemysqlpump Parallel Processing.
mysqlpump --parallel-schemas ...
--password[
The password of the MySQL account used for connecting to the server. The password value is optional. If not given, mysqlpumpprompts for one. If given, there must be no space between --password= or -p and the password following it. If no password optionis specified, the default is to send no password.Specifying a password on the command line should be considered insecure. To avoid giving the password on the command line, use anoption file. See Section 6.1.2.1, “End-User Guidelines for Password Security”.To explicitly specify that there is no password and that mysqlpump should not prompt for one, use the --skip-password option.
mysqlpump --password[ ...
--plugin-dir
The directory in which to look for plugins. Specify this option if the --default-auth option is used to specify an authenticationplugin but mysqlpump does not find it. See Section 6.2.17, “Pluggable Authentication”.
mysqlpump --plugin-dir ...
--port
For TCP/IP connections, the port number to use.
mysqlpump --port ...
--print-defaults
Print the program name and all options that it gets from option files.For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that AffectOption-File Handling”.
mysqlpump --print-defaults ...
--protocol
The connection protocol to use for connecting to the server. It is useful when the other connection parameters normally result inuse of a protocol other than the one you want. For details on the permissible values, see Section 4.2.4, “Connecting to the MySQLServer Using Command Options”.
mysqlpump --protocol ...
--replace
Write REPLACE statements rather than INSERT statements.
mysqlpump --replace ...
--result-file
Direct output to the named file. The result file is created and its previous contents overwritten, even if an error occurs whilegenerating the dump.This option should be used on Windows to prevent newline \n characters from being converted to \r\n carriage return/newlinesequences.
mysqlpump --result-file ...
--routines
Include stored routines (procedures and functions) for the dumped databases in the output. This option requires the global SELECTprivilege.The output generated by using --routines contains CREATE PROCEDURE and CREATE FUNCTION statements to create the routines.This option is enabled by default; use --skip-routines to disable it.
mysqlpump --routines ...
--secure-auth
This option was removed in MySQL 8.0.3.
mysqlpump --secure-auth ...
--server-public-key-path
The path name to a file containing a client-side copy of the public key required by the server for RSA key pair-based passwordexchange. The file must be in PEM format. This option applies to clients that authenticate with the sha256_password orcaching_sha2_password authentication plugin. This option is ignored for accounts that do not authenticate with one of thoseplugins. It is also ignored if RSA-based password exchange is not used, as is the case when the client connects to the serverusing a secure connection.If --server-public-key-path=file_name is given and specifies a valid public key file, it takes precedence over
mysqlpump --server-public-key-path ...
--set-charset
Write SET NAMES default_character_set to the output.This option is enabled by default. To disable it and suppress the SET NAMES statement, use --skip-set-charset.
mysqlpump --set-charset ...
--set-gtid-purged
This option enables control over global transaction ID (GTID) information written to the dump file, by indicating whether to adda SET @@GLOBAL.gtid_purged statement to the output. This option may also cause a statement to be written to the output thatdisables binary logging while the dump file is being reloaded.The following table shows the permitted option values. The default value is AUTO.┌──────┬────────────────────────────────────────────────┐│Value │ Meaning │├──────┼────────────────────────────────────────────────┤│OFF │ Add no SET statement to the output. │├──────┼────────────────────────────────────────────────┤│ON │ Add a SET statement to the output. An error ││ │ occurs if ││ │ GTIDs are not enabled on the ││ │ server. │├──────┼────────────────────────────────────────────────┤│AUTO │ Add a SET statement to the output if GTIDs are ││ │ enabled on the server. │└──────┴────────────────────────────────────────────────┘The --set-gtid-purged option has the following effect on binary logging when the dump file is reloaded:
mysqlpump --set-gtid-purged ...
--single-transaction
This option sets the transaction isolation mode to REPEATABLE READ and sends a START TRANSACTION SQL statement to the serverbefore dumping data. It is useful only with transactional tables such as InnoDB, because then it dumps the consistent state ofthe database at the time when START TRANSACTION was issued without blocking any applications.When using this option, you should keep in mind that only InnoDB tables are dumped in a consistent state. For example, any MyISAMor MEMORY tables dumped while using this option may still change state.While a --single-transaction 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: ALTER TABLE, CREATE TABLE, DROP TABLE, RENAME TABLE, TRUNCATE TABLE. Aconsistent read is not isolated from those statements, so use of them on a table to be dumped can cause the SELECT that isperformed by mysqlpump to retrieve the table contents to obtain incorrect contents or fail.
mysqlpump --single-transaction ...
--skip-definer
Omit DEFINER and SQL SECURITY clauses from the CREATE statements for views and stored programs. The dump file, when reloaded,creates objects that use the default DEFINER and SQL SECURITY values. See Section 24.6, “Stored Object Access Control”.
mysqlpump --skip-definer ...
--skip-dump-rows
Do not dump table rows.
mysqlpump --skip-dump-rows ...
--socket
For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.On Windows, this option applies only if the server was started with the named_pipe system variable enabled to support named-pipeconnections. In addition, the user making the connection must be a member of the Windows group specified by thenamed_pipe_full_access_group system variable.
mysqlpump --socket ...
--ssl*
Options that begin with --ssl specify whether to connect to the server using SSL and indicate where to find SSL keys andcertificates. See the section called “Command Options for Encrypted Connections”.
mysqlpump --ssl* ...
--tls-ciphersuites
The permissible ciphersuites for encrypted connections that use TLSv1.3. The value is a list of one or more colon-separatedciphersuite names. The ciphersuites that can be named for this option depend on the SSL library used to compile MySQL. Fordetails, see Section 6.3.2, “Encrypted Connection TLS Protocols and Ciphers”.This option was added in MySQL 8.0.16.
mysqlpump --tls-ciphersuites ...
--tls-version
The permissible TLS protocols for encrypted connections. The value is a list of one or more comma-separated protocol names. Theprotocols that can be named for this option depend on the SSL library used to compile MySQL. For details, see Section 6.3.2,“Encrypted Connection TLS Protocols and Ciphers”.
mysqlpump --tls-version ...
--triggers
Include triggers for each dumped table in the output.This option is enabled by default; use --skip-triggers to disable it.
mysqlpump --triggers ...
--tz-utc
This option enables TIMESTAMP columns to be dumped and reloaded between servers in different time zones. mysqlpump sets itsconnection time zone to UTC and adds SET TIME_ZONE='+00:00' to the dump file. Without this option, TIMESTAMP columns are dumpedand reloaded in the time zones local to the source and destination servers, which can cause the values to change if the serversare in different time zones. --tz-utc also protects against changes due to daylight saving time.This option is enabled by default; use --skip-tz-utc to disable it.
mysqlpump --tz-utc ...
--user
The user name of the MySQL account to use for connecting to the server.
mysqlpump --user ...
--users
Dump user accounts as logical definitions in the form of CREATE USER and GRANT statements.User definitions are stored in the grant tables in the mysql system database. By default, mysqlpump does not include the granttables in mysql database dumps. To dump the contents of the grant tables as logical definitions, use the --users option andsuppress all database dumping:shell> mysqlpump --exclude-databases=% --users
mysqlpump --users ...
--version
Display version information and exit.
mysqlpump --version ...
--watch-progress
Periodically display a progress indicator that provides information about the completed and total number of tables, rows, andother objects.This option is enabled by default; use --skip-watch-progress to disable it.
mysqlpump --watch-progress ...
--all-databases.
· The --databases option causes mysqlpump to treat all name arguments as names of databases to dump. It is equivalent to an
mysqlpump --all-databases. ...