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. It dumps one or more MySQL databases for backup or transfer to another SQL server.mysqlpump客户端实用程序执行逻辑备份,生成一组SQL语句,可以执行这些语句来重现原始数据库对象定义和表数据。它转储一个或多个MySQL数据库以进行备份或传输到另一个SQL服务器。
Consider using the MySQL Shell dump utilities, which provide parallel dumping with multiple threads, file compression, and progress information display, as well as cloud features such as Oracle Cloud Infrastructure Object Storage streaming, and MySQL Database Service compatibility checks and modifications. 考虑使用MySQL Shell转储实用程序,该实用程序提供多线程并行转储、文件压缩和进度信息显示,以及Oracle云基础设施对象存储流和MySQL数据库服务兼容性检查和修改等云功能。Dumps can be easily imported into a MySQL Server instance or a MySQL Database Service DB System using the MySQL Shell load dump utilities. 转储可以使用MySQL Shell加载转储实用程序轻松导入MySQL Server实例或MySQL数据库服务DB系统。Installation instructions for MySQL Shell can be found here.MySQL Shell的安装说明可以在这里找到。
mysqlpump features include:mysqlpump的功能包括:
Parallel processing of databases, and of objects within databases, to speed up the dump process并行处理数据库和数据库内的对象,以加快转储过程
Better control over which databases and database objects (tables, stored programs, user accounts) to dump更好地控制要转储的数据库和数据库对象(表、存储程序、用户帐户)
Dumping of user accounts as account-management statements (将用户帐户作为帐户管理语句(CREATE USER
, GRANT
) rather than as inserts into the mysql
system databaseCREATE USER
、GRANT
)转储,而不是作为插入到mysql系统数据库中
Capability of creating compressed output创建压缩输出的能力
Progress indicator (the values are estimates)进度指标(数值为估计值)
For dump file reloading, faster secondary index creation for 对于转储文件的重新加载,通过在插入行后添加索引,可以更快地为InnoDB
tables by adding indexes after rows are insertedInnoDB
表创建辅助索引
mysqlpump uses MySQL features introduced in MySQL 5.7, and thus assumes use with MySQL 5.7 or higher.mysqlpump使用MySQL 5.7中引入的MySQL功能,因此假设与MySQL 5.7或更高版本一起使用。
mysqlpump requires at least the mysqlpump至少要求转储表具有SELECT
privilege for dumped tables, SHOW VIEW
for dumped views, TRIGGER
for dumped triggers, and LOCK TABLES
if the --single-transaction
option is not used. SELECT
权限,转储视图具有SHOW VIEW
权限,转储触发器具有TRIGGER
权限,如果不使用--single-transaction
选项,则需要LOCK TABLES
权限。The 转储用户定义需要mysql系统数据库上的SELECT
privilege on the mysql
system database is required to dump user definitions. Certain options might require other privileges as noted in the option descriptions.SELECT
权限。某些选项可能需要其他权限,如选项描述中所述。
To reload a dump file, you must have the privileges required to execute the statements that it contains, such as the appropriate 要重新加载转储文件,您必须具有执行其中包含的语句所需的权限,例如对这些语句创建的对象具有适当的CREATE
privileges for objects created by those statements.CREATE
权限。
A dump made using PowerShell on Windows with output redirection creates a file that has UTF-16 encoding:在带有输出重定向的Windows上使用PowerShell进行的转储会创建一个具有UTF-16编码的文件:
mysqlpump [options] > dump.sql
However, UTF-16 is not permitted as a connection character set (see Section 10.4, “Connection Character Sets and Collations”), so the dump file cannot be loaded correctly. 但是,UTF-16不允许作为连接字符集(请参阅第10.4节,“连接字符集和排序规则”),因此无法正确加载转储文件。To work around this issue, use the 要解决此问题,请使用--result-file
option, which creates the output in ASCII format:--result-file
选项,该选项将创建ASCII格式的输出:
mysqlpump [options] --result-file=dump.sql
By default, mysqlpump dumps all databases (with certain exceptions noted in mysqlpump Restrictions). 默认情况下,mysqlpump会转储所有数据库(mysqlpump限制中注明的某些例外情况除外)。To specify this behavior explicitly, use the 要明确指定此行为,请使用--all-databases
option:--all-databases
选项:
mysqlpump --all-databases
To dump a single database, or certain tables within that database, name the database on the command line, optionally followed by table names:要转储单个数据库或该数据库中的某些表,请在命令行中命名数据库,然后可选地后跟表名:
mysqlpumpdb_name
mysqlpumpdb_name tbl_name1 tbl_name2 ...
To treat all name arguments as database names, use the 要将所有名称参数视为数据库名称,请使用--databases
option:--databases
选项:
mysqlpump --databases db_name1 db_name2
...
By default, mysqlpump does not dump user account definitions, even if you dump the 默认情况下,mysqlpump不会转储用户帐户定义,即使您转储了包含授权表的mysql
system database that contains the grant tables. mysql
系统数据库。To dump grant table contents as logical definitions in the form of 要以CREATE USER
and GRANT
statements, use the --users
option and suppress all database dumping:CREATE USER
和GRANT
语句的形式将授权表内容作为逻辑定义转储,请使用--users
选项并禁止所有数据库转储:
mysqlpump --exclude-databases=% --users
In the preceding command, 在前面的命令中,%
is a wildcard that matches all database names for the --exclude-databases
option.%
是一个通配符,与--exclude-databases
选项的所有数据库名称匹配。
mysqlpump supports several options for including or excluding databases, tables, stored programs, and user definitions. See mysqlpump Object Selection.mysqlpump支持多种选项,用于包含或排除数据库、表、存储程序和用户定义。请参阅mysqlpump对象选择。
To reload a dump file, execute the statements that it contains. For example, use the mysql client:要重新加载转储文件,请执行其中包含的语句。例如,使用mysql客户端:
mysqlpump [options] > dump.sql mysql < dump.sql
The following discussion provides additional mysqlpump usage examples.以下讨论提供了其他mysqlpump使用示例。
To see a list of the options mysqlpump supports, issue the command mysqlpump --help.要查看mysqlpump支持的选项列表,请发出命令mysqlpump --help
。
mysqlpump supports the following options, which can be specified on the command line or in the mysqlpump支持以下选项,可以在命令行或选项文件的[mysqlpump]
and [client]
groups of an option file. [mysqlpump]
和[client]
组中指定。(Prior to MySQL 8.0.20, mysqlpump read the (在MySQL 8.0.20之前,mysqlpump读取的是[mysql_dump]
group rather than [mysqlpump]
. [MySQL_dump]
组,而不是[mysqlpump]
。As of 8.0.20, 截至8.0.20,[mysql_dump]
is still accepted but is deprecated.) For information about option files used by MySQL programs, see Section 4.2.2.2, “Using Option Files”.[mysql_dump]
仍然被接受,但已被弃用。)有关MySQL程序使用的选项文件的信息,请参阅第4.2.2.2节,“使用选项文件”。
Table 4.16 mysqlpump Options表4.16 mysqlpump选项
--add-drop-database | CREATE DATABASE 语句之前添加DROP DATABASE 语句 | ||
---|---|---|---|
--add-drop-table | CREATE TABLE 语句之前添加DROP TABLE 语句 | ||
--add-drop-user | CREATE USER 语句之前添加DROP USER 语句 | ||
--add-locks | LOCK TABLES 和UNLOCK TABLES 语句包围每个表转储 | ||
--all-databases | |||
--bind-address | |||
--character-sets-dir | |||
--column-statistics | ANALYZE TABLE 语句以生成统计直方图 | ||
--complete-insert | INSERT 语句 | ||
--compress | 8.0.18 | ||
--compress-output | |||
--compression-algorithms | 8.0.18 | ||
--databases | |||
--debug | |||
--debug-check | |||
--debug-info | |||
--default-auth | |||
--default-character-set | |||
--default-parallelism | |||
--defaults-extra-file | |||
--defaults-file | |||
--defaults-group-suffix | |||
--defer-table-indexes | |||
--events | |||
--exclude-databases | |||
--exclude-events | |||
--exclude-routines | |||
--exclude-tables | |||
--exclude-triggers | |||
--exclude-users | |||
--extended-insert | |||
--get-server-public-key | |||
--help | |||
--hex-blob | |||
--host | |||
--include-databases | |||
--include-events | |||
--include-routines | |||
--include-tables | |||
--include-triggers | |||
--include-users | |||
--insert-ignore | INSERT IGNORE 而不是INSERT 语句 | ||
--log-error-file | |||
--login-path | .mylogin.cnf 读取登录路径选项 | ||
--max-allowed-packet | |||
--net-buffer-length | |||
--no-create-db | CREATE DATABASE 语句 | ||
--no-create-info | CREATE TABLE 语句来重新创建每个转储的表 | ||
--no-defaults | |||
--parallel-schemas | |||
--password | |||
--plugin-dir | |||
--port | |||
--print-defaults | |||
--protocol | |||
--replace | REPLACE 语句而不是INSERT 语句 | ||
--result-file | |||
--routines | |||
--server-public-key-path | |||
--set-charset | |||
--set-gtid-purged | SET @@GLOBAL.GTID_PURGED 添加到输出 | ||
--single-transaction | |||
--skip-definer | CREATE 语句中省略DEFINER 和SQL SECURITY 子句 | ||
--skip-dump-rows | |||
--socket | |||
--ssl-ca | |||
--ssl-capath | |||
--ssl-cert | |||
--ssl-cipher | |||
--ssl-crl | |||
--ssl-crlpath | |||
--ssl-fips-mode | |||
--ssl-key | |||
--ssl-mode | |||
--tls-ciphersuites | 8.0.16 | ||
--tls-version | |||
--triggers | |||
--tz-utc | SET TIME_ZONE='+00:00' 添加到转储文件 | ||
--user | |||
--users | |||
--version | |||
--watch-progress | |||
--zstd-compression-level | 8.0.18 |
--help
, -?
Display a help message and exit.显示帮助消息并退出。
Write a 在每条DROP DATABASE
statement before each CREATE DATABASE
statement.CREATE DATABASE
语句之前写一条DROP DATABASE
语句。
In MySQL 8.0, the 在MySQL 8.0中,mysql
schema is considered a system schema that cannot be dropped by end users. mysql
模式被认为是最终用户不能删除的系统模式。If 如果--add-drop-database
is used with --all-databases
or with --databases
where the list of schemas to be dumped includes mysql
, the dump file contains a DROP DATABASE `mysql`
statement that causes an error when the dump file is reloaded.--add-drop-database
与--all-databases
或与--databases
一起使用,其中要转储的模式列表包括mysql
,则转储文件包含一个DROP DATABASE `mysql`
语句,该语句在重新加载转储文件时会导致错误。
Instead, to use 相反,要使用--add-drop-database
, use --databases
with a list of schemas to be dumped, where the list does not include mysql
.--add-drop-database
,请使用带有要转储的模式列表的--databases
,其中列表不包括mysql
。
Write a 在每个DROP TABLE
statement before each CREATE TABLE
statement.CREATE TABLE
语句之前写一个DROP TABLE
语句。
Write a 在每个DROP USER
statement before each CREATE USER
statement.CREATE USER
语句之前写一个DROP USER
语句。
Surround each table dump with 用LOCK TABLES
and UNLOCK TABLES
statements. This results in faster inserts when the dump file is reloaded. LOCK TABLES
和UNLOCK TABLES
语句包围每个表转储。这使得在重新加载转储文件时插入速度更快。See Section 8.2.5.1, “Optimizing INSERT Statements”.请参阅第8.2.5.1节,“优化INSERT语句”。
This option does not work with parallelism because 此选项不适用于并行处理,因为来自不同表的INSERT
statements from different tables can be interleaved and UNLOCK TABLES
following the end of the inserts for one table could release locks on tables for which inserts remain.INSERT
语句可以交错执行,并且在一个表的插入结束后的UNLOCK TABLES
可以释放保留插入的表上的锁。
--add-locks
and --single-transaction
are mutually exclusive.--add-locks
和--single-transaction
是互斥的。
--all-databases
, -A
Dump all databases (with certain exceptions noted in mysqlpump Restrictions). This is the default behavior if no other is specified explicitly.转储所有数据库(mysqlpump限制中注明的某些例外情况除外)。如果没有明确指定其他行为,则这是默认行为。
--all-databases
and --databases
are mutually exclusive.--all-databases
和--databases
都是互斥的。
See the 有关该选项与--add-drop-database
description for information about an incompatibility of that option with --all-databases
.--all-databases
不兼容的信息,请参阅--add-drop-database
描述。
Prior to MySQL 8.0, the 在MySQL 8.0之前,当使用--routines
and --events
options for mysqldump and mysqlpump were not required to include stored routines and events when using the --all-databases
option: The dump included the mysql
system database, and therefore also the mysql.proc
and mysql.event
tables containing stored routine and event definitions. --all-databases
选项时,mysqldump和mysqlpump的--routines
和--events
选项不需要包括存储的例程和事件:转储包括MySQL系统数据库,因此也包括包含存储例程和事件定义的mysql.proc
和mysql.event
表。As of MySQL 8.0, the 从MySQL 8.0开始,不使用mysql.event
and mysql.proc
tables are not used. mysql.event
和mysql.proc
表。Definitions for the corresponding objects are stored in data dictionary tables, but those tables are not dumped. 相应对象的定义存储在数据字典表中,但这些表不会转储。To include stored routines and events in a dump made using 要在使用--all-databases
, use the --routines
and --events
options explicitly.--all-databases
创建的转储中包含存储的例程和事件,请显式使用--routines
和--events
选项。
On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server.在具有多个网络接口的计算机上,使用此选项选择用于连接MySQL服务器的接口。
The directory where character sets are installed. See Section 10.15, “Character Set Configuration”.安装字符集的目录。参阅第10.15节,“字符集配置”。
Add 将ANALYZE TABLE
statements to the output to generate histogram statistics for dumped tables when the dump file is reloaded. ANALYZE TABLE
语句添加到输出中,以便在重新加载转储文件时为转储的表生成直方图统计信息。This option is disabled by default because histogram generation for large tables can take a long time.默认情况下,此选项处于禁用状态,因为大型表的直方图生成可能需要很长时间。
Write complete 编写包含列名的完整INSERT
statements that include column names.INSERT
语句。
--compress
, -C
Compress all information sent between the client and the server if possible. See Section 4.2.8, “Connection Compression Control”.如果可能的话,压缩客户端和服务器之间发送的所有信息。参阅第4.2.8节,“连接压缩控制”。
As of MySQL 8.0.18, this option is deprecated. Expect it to be removed in a future version of MySQL. 从MySQL 8.0.18开始,此选项已被弃用。预计它将在MySQL的未来版本中被删除。See Configuring Legacy Connection Compression.请参阅配置传统连接压缩。
By default, mysqlpump does not compress output. This option specifies output compression using the specified algorithm. Permitted algorithms are 默认情况下,mysqlpump不压缩输出。此选项使用指定的算法指定输出压缩。允许的算法是LZ4
and ZLIB
.LZ4
和ZLIB
。
To uncompress compressed output, you must have an appropriate utility. 要解压缩压缩输出,您必须有一个适当的实用程序。If the system commands lz4 and openssl zlib are not available, MySQL distributions include lz4_decompress and zlib_decompress utilities that can be used to decompress mysqlpump output that was compressed using the 如果系统命令--compress-output=LZ4
and --compress-output=ZLIB
options. lz4
和openssl-zlib
不可用,MySQL发行版包括lz4_decompress
和zlib_decompress
实用程序,可用于解压缩使用--compress-output=lz4
和--compress-output=zlib
选项压缩的mysqlpump输出。For more information, see Section 4.8.1, “lz4_decompress — Decompress mysqlpump LZ4-Compressed Output”, and Section 4.8.3, “zlib_decompress — Decompress mysqlpump ZLIB-Compressed Output”.有关更多信息,请参阅第4.8.1节,“lz4_decompress-解压缩mysqlpump lz4压缩输出”和第4.8.3节,“zlib_decompress--解压缩mysqlpump-zlib压缩输出”。
--compression-algorithms=
value
The permitted compression algorithms for connections to the server. 允许用于连接到服务器的压缩算法。The available algorithms are the same as for the 可用的算法与protocol_compression_algorithms
system variable. protocol_compression_algorithms
系统变量的算法相同。The default value is 默认值为uncompressed
.uncompressed
。
For more information, see Section 4.2.8, “Connection Compression Control”.有关更多信息,请参阅第4.2.8节,“连接压缩控制”。
This option was added in MySQL 8.0.18.此选项是在MySQL 8.0.18中添加的。
--databases
, -B
Normally, mysqlpump treats the first name argument on the command line as a database name and any following names as table names. 通常,mysqlpump将命令行上的第一个name参数视为数据库名称,将任何后续名称视为表名称。With this option, it treats all name arguments as database names. 使用此选项,它将所有名称参数视为数据库名称。CREATE DATABASE
statements are included in the output before each new database.CREATE DATABASE
语句包含在每个新数据库之前的输出中。
--all-databases
and --databases
are mutually exclusive.--all-databases
和--databases
都是互斥的。
See the 有关该选项与--add-drop-database
description for information about an incompatibility of that option with --databases
.--databases
不兼容的信息,请参阅--add-drop-database
描述。
--debug[=
, debug_options
]-# [
debug_options
]
Write a debugging log. A typical 编写调试日志。典型的debug_options
string is d:t:o,
. The default is file_name
d:t:O,/tmp/mysqlpump.trace
.debug_options
字符串是d:t:o,file_name
。默认值为d:t:O,/tmp/mysqlpump.trace
。
This option is available only if MySQL was built using 仅当MySQL使用WITH_DEBUG
. MySQL release binaries provided by Oracle are not built using this option.WITH_DEBUG
构建时,此选项才可用。Oracle提供的MySQL发布二进制文件不是使用此选项构建的。
Print some debugging information when the program exits.程序退出时打印一些调试信息。
This option is available only if MySQL was built using 仅当MySQL使用WITH_DEBUG
. MySQL release binaries provided by Oracle are not built using this option.WITH_DEBUG
构建时,此选项才可用。Oracle提供的MySQL发布二进制文件不是使用此选项构建的。
--debug-info
, -T
Print debugging information and memory and CPU usage statistics when the program exits.程序退出时打印调试信息以及内存和CPU使用统计数据。
This option is available only if MySQL was built using 仅当MySQL使用WITH_DEBUG
. MySQL release binaries provided by Oracle are not built using this option.WITH_DEBUG
构建时,此选项才可用。Oracle提供的MySQL发布二进制文件不是使用此选项构建的。
A hint about which client-side authentication plugin to use. See Section 6.2.17, “Pluggable Authentication”.关于使用哪个客户端身份验证插件的提示。参阅第6.2.17节,“可插拔身份验证”。
--default-character-set=
charset_name
Use 使用charset_name
as the default character set. See Section 10.15, “Character Set Configuration”. charset_name
作为默认字符集。参阅第10.15节,“字符集配置”。If no character set is specified, mysqlpump uses 如果没有指定字符集,mysqlpump将使用utf8
.utf8
。
The default number of threads for each parallel processing queue. The default is 2.每个并行处理队列的默认线程数。默认值为2。
The --parallel-schemas
option also affects parallelism and can be used to override the default number of threads. For more information, see mysqlpump Parallel Processing.--parallel-schemas
选项也会影响并行性,可用于覆盖默认线程数。有关更多信息,请参阅mysqlpump并行处理。
With 使用--default-parallelism=0
and no --parallel-schemas
options, mysqlpump runs as a single-threaded process and creates no queues.--default-parallelism=0
且不使用--parallel-schemas
选项,mysqlpump作为单线程进程运行,不创建队列。
With parallelism enabled, it is possible for output from different databases to be interleaved.启用并行性后,不同数据库的输出可以交错。
--defaults-extra-file=
file_name
Read this option file after the global option file but (on Unix) before the user option file. 在全局选项文件之后读取此选项文件,但(在Unix上)在用户选项文件之前读取。If the file does not exist or is otherwise inaccessible, an error occurs. If 如果文件不存在或无法访问,则会发生错误。如果file_name
is not an absolute path name, it is interpreted relative to the current directory.file_name
不是绝对路径名,则会相对于当前目录进行解释。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
Use only the given option file. If the file does not exist or is otherwise inaccessible, an error occurs. 仅使用给定的选项文件。如果文件不存在或无法访问,则会发生错误。If 如果file_name
is not an absolute path name, it is interpreted relative to the current directory.file_name
不是绝对路径名,则会相对于当前目录进行解释。
Exception: Even with 异常:即使使用--defaults-file
, client programs read .mylogin.cnf
.--defaults-file
,客户端程序也会读取.mylogin.cnf
。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
Read not only the usual option groups, but also groups with the usual names and a suffix of 不仅要读取常用的选项组,还要读取具有常用名称和后缀str
. str
的组。For example, mysqlpump normally reads the 例如,mysqlpump通常读取[client]
and [mysqlpump]
groups. [client]
和[mysqlpump]
组。If this option is given as 如果将此选项设置为--defaults-group-suffix=_other
, mysqlpump also reads the [client_other]
and [mysqlpump_other]
groups.--defaults-group-suffix=_other
,mysqlpump还会读取[client_other]
和[mysqlpump_other]
组。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
In the dump output, defer index creation for each table until after its rows have been loaded. This works for all storage engines, but for 在转储输出中,将每个表的索引创建推迟到其行被加载之后。这适用于所有存储引擎,但InnoDB
applies only for secondary indexes.InnoDB
仅适用于辅助索引。
This option is enabled by default; use 默认情况下启用此选项;使用--skip-defer-table-indexes
to disable it.--skip-defer-table-indexes
来禁用它。
Include Event Scheduler events for the dumped databases in the output. Event dumping requires the 在输出中包含转储数据库的事件计划程序事件。事件转储需要这些数据库的EVENT
privileges for those databases.EVENT
权限。
The output generated by using 使用--events
contains CREATE EVENT
statements to create the events.--events
生成的输出包含创建事件的CREATE EVENT
语句。
This option is enabled by default; use 默认情况下启用此选项;使用--skip-events
to disable it.--skip-events
禁用它。
Do not dump the databases in 不要转储db_list
, which is a list of one or more comma-separated database names. Multiple instances of this option are additive. db_list
中的数据库,db_list
是一个或多个逗号分隔的数据库名称的列表。此选项的多个实例是累加的。For more information, see mysqlpump Object Selection.有关更多信息,请参阅mysqlpump对象选择。
Do not dump the databases in 不要在event_list
, which is a list of one or more comma-separated event names. Multiple instances of this option are additive. event_list
中转储数据库,event_list
是一个或多个逗号分隔的事件名称列表。此选项的多个实例是累加的。For more information, see mysqlpump Object Selection.有关更多信息,请参阅mysqlpump对象选择。
--exclude-routines=
routine_list
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.route_list
中转储事件,route_list
是一个或多个逗号分隔的例程(存储过程或函数)名称的列表。此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
Do not dump the tables in 不要转储table_list
, which is a list of one or more comma-separated table names. Multiple instances of this option are additive. table_list
中的表,table_list
是一个或多个逗号分隔的表名列表。此选项的多个实例是累加的。For more information, see mysqlpump Object Selection.有关更多信息,请参阅mysqlpump对象选择。
--exclude-triggers=
trigger_list
Do not dump the triggers in 不要在trigger_list
, which is a list of one or more comma-separated trigger names. Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.trigger_list
中转储触发器,trigger_list
是一个或多个逗号分隔的触发器名称的列表。此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
Do not dump the user accounts in 不要在user_list
, which is a list of one or more comma-separated account names. Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.user_list
中转储用户帐户,user_list
是一个或多个逗号分隔的帐户名列表。此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
Write 使用包含多个INSERT
statements using multiple-row syntax that includes several VALUES
lists. This results in a smaller dump file and speeds up inserts when the file is reloaded.VALUES
列表的多行语法编写INSERT
语句。这会导致转储文件变小,并在重新加载文件时加快插入速度。
The option value indicates the number of rows to include in each 选项值表示每个INSERT
statement. The default is 250. A value of 1 produces one INSERT
statement per table row.INSERT
语句中要包含的行数。默认值为250。值为1时,每个表行生成一个INSERT
语句。
Request from the server the public key required for RSA key pair-based password exchange. 从服务器请求基于RSA密钥对的密码交换所需的公钥。This option applies to clients that authenticate with the 此选项适用于使用caching_sha2_password
authentication plugin. caching_sha2_password
身份验证插件进行身份验证的客户端。For that plugin, the server does not send the public key unless requested. 对于该插件,除非请求,否则服务器不会发送公钥。This option is ignored for accounts that do not authenticate with that plugin. 对于不使用该插件进行身份验证的帐户,此选项将被忽略。It is also ignored if RSA-based password exchange is not used, as is the case when the client connects to the server using a secure connection.如果不使用基于RSA的密码交换,它也会被忽略,就像客户端使用安全连接连接到服务器的情况一样。
If 如果给定了--server-public-key-path=
is given and specifies a valid public key file, it takes precedence over file_name
--get-server-public-key
.--server-public-key-path=file_name
并指定了一个有效的公钥文件,则它优先于--get-server-public-key
。
For information about the 有关caching_sha2_password
plugin, see Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.caching_sha2_password
插件的信息,请参阅第6.4.1.2节,“缓存SHA-2可插拔身份验证”。
Dump binary columns using hexadecimal notation (for example, 使用十六进制表示法转储二进制列(例如,'abc'
becomes 0x616263
). 'abc'
变为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.binary
字符集一起使用时,受影响的数据类型包括BINARY
、VARBINARY
、BLOB
类型、BIT
、所有空间数据类型和其他非二进制数据类型。
--host=
, host_name
-h
host_name
Dump data from the MySQL server on the given host.从给定主机上的MySQL服务器转储数据。
Dump the databases in 转储db_list中的数据库,db_list
, which is a list of one or more comma-separated database names. db_list
是一个或多个逗号分隔的数据库名称的列表。The dump includes all objects in the named databases. Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.转储包括命名数据库中的所有对象。此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
Dump the events in 转储event_list
, which is a list of one or more comma-separated event names. Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.event_list
中的事件,event_list
是一个或多个逗号分隔的事件名称列表。此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
--include-routines=
routine_list
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.route_list
中的例程,route_list
是一个或多个逗号分隔的例程(存储过程或函数)名称的列表。此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
Dump the tables in 转储table_list
, which is a list of one or more comma-separated table names. Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.table_list
中的表,这是一个由一个或多个逗号分隔的表名组成的列表。此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
--include-triggers=
trigger_list
Dump the triggers in 在trigger_list
, which is a list of one or more comma-separated trigger names. trigger_list
中转储触发器,trigger_list
是一个或多个逗号分隔的触发器名称的列表。Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
Dump the user accounts in 在user_list
, which is a list of one or more comma-separated user names. user_list
中转储用户帐户,user_list
是一个或多个逗号分隔的用户名列表。Multiple instances of this option are additive. For more information, see mysqlpump Object Selection.此选项的多个实例是累加的。有关更多信息,请参阅mysqlpump对象选择。
Write 编写INSERT IGNORE
statements rather than INSERT
statements.INSERT IGNORE
语句而不是INSERT
语句。
Log warnings and errors by appending them to the named file. If this option is not given, mysqlpump writes warnings and errors to the standard error output.通过将警告和错误附加到指定文件来记录它们。如果不提供此选项,mysqlpump会将警告和错误写入标准错误输出。
Read options from the named login path in the 从.mylogin.cnf
login path file. .mylogin.cnf
登录路径文件中的指定登录路径读取选项。A “login path” is an option group containing options that specify which MySQL server to connect to and which account to authenticate as. “登录路径”是一个选项组,其中包含指定要连接到哪个MySQL服务器以及要作为哪个帐户进行身份验证的选项。To create or modify a login path file, use the mysql_config_editor utility. 要创建或修改登录路径文件,请使用mysql_config_editor实用程序。See Section 4.6.7, “mysql_config_editor — MySQL Configuration Utility”.请参阅第4.6.7节,“mysql_config编辑器--mysql配置实用程序”。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
The maximum size of the buffer for client/server communication. The default is 24MB, the maximum is 1GB.客户端/服务器通信的最大缓冲区大小。默认值为24MB,最大值为1GB。
The initial size of the buffer for client/server communication. When creating multiple-row 客户端/服务器通信缓冲区的初始大小。当创建多行INSERT
statements (as with the --extended-insert
option), mysqlpump creates rows up to N
bytes long. INSERT
语句时(与--extended-insert
选项一样),mysqlpump会创建长达N
字节的行。If you use this option to increase the value, ensure that the MySQL server 如果使用此选项增加值,请确保MySQL服务器net_buffer_length
system variable has a value at least this large.net_buffer_length
系统变量的值至少如此之大。
Suppress any 禁止输出中可能包含的任何CREATE DATABASE
statements that might otherwise be included in the output.CREATE DATABASE
语句。
--no-create-info
, -t
Do not write 不要编写创建每个转储表的CREATE TABLE
statements that create each dumped table.CREATE TABLE
语句。
Do not read any option files. 不要读取任何选项文件。If program startup fails due to reading unknown options from an option file, 如果程序启动因从选项文件中读取未知选项而失败,则使用--no-defaults
can be used to prevent them from being read.--no-defaults
来阻止读取它们。
The exception is that the 例外的是,.mylogin.cnf
file is read in all cases, if it exists. .mylogin.cnf
文件在所有情况下都会被读取(如果存在的话)。This permits passwords to be specified in a safer way than on the command line even when 这允许以比命令行更安全的方式指定密码,即使使用--no-defaults
is used. --no-defaults
。To create 要创建.mylogin.cnf
, use the mysql_config_editor utility. See Section 4.6.7, “mysql_config_editor — MySQL Configuration Utility”..mylogin.cnf
,请使用mysql_config_editor实用程序。请参阅第4.6.7节,“mysql_config编辑器--mysql配置实用程序”。
For additional information about this and other option-file options, see Section 4.2.2.3, “Command-Line Options that Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
--parallel-schemas=[
N
:]db_list
Create a queue for processing the databases in 创建一个队列来处理db_list
, which is a list of one or more comma-separated database names. db_list
中的数据库,db_list
是一个或多个逗号分隔的数据库名称的列表。If 如果给定N
is given, the queue uses N
threads. N
,则队列使用N
个线程。If 如果没有给出N
is not given, the --default-parallelism
option determines the number of queue threads.N
,--default-parallelism
选项将确定队列线程的数量。
Multiple instances of this option create multiple queues. mysqlpump also creates a default queue to use for databases not named in any 此选项的多个实例会创建多个队列。mysqlpump还创建了一个默认队列,用于在任何--parallel-schemas
option, and for dumping user definitions if command options select them. --parallel-schemas
选项中未命名的数据库,以及在命令选项选择用户定义时转储用户定义。For more information, see mysqlpump Parallel Processing.有关更多信息,请参阅mysqlpump并行处理。
--password[=
, password
]-p[
password
]
The password of the MySQL account used for connecting to the server. 用于连接到服务器的MySQL帐户的密码。The password value is optional. If not given, mysqlpump prompts for one. 密码值是可选的。如果没有给出,mysqlpump会提示输入一个。If given, there must be no space between 如果给定,则--password=
or -p
and the password following it. --password=
或-p
与后面的密码之间不得有空格。If no password option is 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 an option file. 为了避免在命令行上输入密码,请使用选项文件。See Section 6.1.2.1, “End-User Guidelines for Password Security”.请参阅第6.1.2.1节,“密码安全最终用户指南”。
To explicitly specify that there is no password and that mysqlpump should not prompt for one, use the 要明确指定没有密码并且mysqlpump不应提示输入密码,请使用--skip-password
option.--skip-password
选项。
The directory in which to look for plugins. 查找插件的目录。Specify this option if the 如果使用--default-auth
option is used to specify an authentication plugin but mysqlpump does not find it. --default-auth
选项指定身份验证插件,但mysqlpump找不到它,请指定此选项。See Section 6.2.17, “Pluggable Authentication”.请参阅第6.2.17节,“可插拔身份验证”。
--port=
, port_num
-P
port_num
For TCP/IP connections, the port number to use.对于TCP/IP连接,要使用的端口号。
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 Affect Option-File Handling”.有关此选项和其他选项文件选项的更多信息,请参阅第4.2.2.3节,“影响选项文件处理的命令行选项”。
--protocol={TCP|SOCKET|PIPE|MEMORY}
The transport protocol to use for connecting to the server. It is useful when the other connection parameters normally result in use of a protocol other than the one you want. 用于连接到服务器的传输协议。当其他连接参数通常导致使用与您想要的协议不同的协议时,它很有用。For details on the permissible values, see Section 4.2.7, “Connection Transport Protocols”.有关允许值的详细信息,请参阅第4.2.7节,“连接传输协议”。
Write 写REPLACE
statements rather than INSERT
statements.REPLACE
语句而不是INSERT
语句。
Direct output to the named file. The result file is created and its previous contents overwritten, even if an error occurs while generating the dump.直接输出到指定文件。即使在生成转储时发生错误,也会创建结果文件并覆盖其先前的内容。
This option should be used on Windows to prevent newline 应在Windows上使用此选项,以防止换行符\n
characters from being converted to \r\n
carriage return/newline sequences.\
转换为回车符/换行符\r\n
序列。
Include stored routines (procedures and functions) for the dumped databases in the output. This option requires the global 在输出中包含转储数据库的存储例程(过程和函数)。此选项需要全局SELECT
privilege.SELECT
权限。
The output generated by using 使用--routines
contains CREATE PROCEDURE
and CREATE FUNCTION
statements to create the routines.--routines
生成的输出包含用于创建例程的CREATE PROCEDURE
和CREATE FUNCTION
语句。
This option is enabled by default; use 默认情况下启用此选项;使用--skip-routines
to disable it.--skip-routines
禁用它。
--server-public-key-path=
file_name
The path name to a file in PEM format containing a client-side copy of the public key required by the server for RSA key pair-based password exchange. PEM格式文件的路径名,该文件包含服务器基于RSA密钥对进行密码交换所需的公钥客户端副本。This option applies to clients that authenticate with the 此选项适用于使用sha256_password
or caching_sha2_password
authentication plugin. sha256_password
或caching_sha2_password
身份验证插件进行身份验证的客户端。This option is ignored for accounts that do not authenticate with one of those plugins. 对于未使用这些插件之一进行身份验证的帐户,此选项将被忽略。It is also ignored if RSA-based password exchange is not used, as is the case when the client connects to the server using a secure connection.如果不使用基于RSA的密码交换,它也会被忽略,就像客户端使用安全连接连接到服务器的情况一样。
If 如果给定了--server-public-key-path=
is given and specifies a valid public key file, it takes precedence over file_name
--get-server-public-key
.--server-public-key-path=file_name
并指定了一个有效的公钥文件,则它优先于--get-server-public-key
。
For 对于sha256_password
, this option applies only if MySQL was built using OpenSSL.sha256_password
,此选项仅适用于使用OpenSSL构建MySQL的情况。
For information about the 有关sha256_password
and caching_sha2_password
plugins, see Section 6.4.1.3, “SHA-256 Pluggable Authentication”, and Section 6.4.1.2, “Caching SHA-2 Pluggable Authentication”.sha256_password
和caching_sha2_password
插件的信息,请参阅第6.4.1.3节,“SHA-256可插拔身份验证”和第6.4.1.2节,“缓存SHA-2可插拔身份认证”。
Write 将SET NAMES
to the output.default_character_set
SET NAMES default_character_set
写入输出。
This option is enabled by default. To disable it and suppress the 默认情况下启用此选项。要禁用它并抑制SET NAMES
statement, use --skip-set-charset
.SET NAMES
语句,请使用--skip-set-charset
。
This option enables control over global transaction ID (GTID) information written to the dump file, by indicating whether to add a 此选项通过指示是否将SET @@GLOBAL.gtid_purged
statement to the output. SET @@GLOBAL.gtid_purged
语句添加到输出中,启用对写入转储文件的全局事务ID(GTID)信息的控制。This option may also cause a statement to be written to the output that disables binary logging while the dump file is being reloaded.此选项还可能导致在重新加载转储文件时向输出写入一条语句,禁用二进制日志记录。
The following table shows the permitted option values. The default value is 下表显示了允许的选项值。默认值为AUTO
.AUTO
。
OFF | SET statement to the output.SET 语句。 |
ON | SET statement to the output. An error occurs if GTIDs are not enabled on the server.SET 语句添加到输出中。如果服务器上未启用GTID,则会发生错误。 |
AUTO | SET statement to the output if GTIDs are enabled on the server.SET 语句。 |
The 当重新加载转储文件时,--set-gtid-purged
option has the following effect on binary logging when the dump file is reloaded:--set-gtid-purged
选项对二进制日志记录有以下影响:
--set-gtid-purged=OFF
: 不将SET @@SESSION.SQL_LOG_BIN=0;
is not added to the output.SET @@SESSION.SQL_LOG_BIN=0;
添加到输出中。
--set-gtid-purged=ON
: :将SET @@SESSION.SQL_LOG_BIN=0;
is added to the output.SET @@SESSION.SQL_LOG_BIN=0;
添加到输出中。
--set-gtid-purged=AUTO
: :如果您正在备份的服务器上启用了GTID(即,如果AUTO评估为on),则会将SET @@SESSION.SQL_LOG_BIN=0;
is added to the output if GTIDs are enabled on the server you are backing up (that is, if AUTO
evaluates to ON
).SET @@SESSION.SQL_LOG_BIN=0;
添加到输出中。
This option sets the transaction isolation mode to 此选项将事务隔离模式设置为REPEATABLE READ
and sends a START TRANSACTION
SQL statement to the server before dumping data. REPEATABLE READ
,并在转储数据之前向服务器发送START TRANSACTION
SQL语句。It is useful only with transactional tables such as 它只对事务表(如InnoDB
, because then it dumps the consistent state of the database at the time when START TRANSACTION
was issued without blocking any applications.InnoDB
)有用,因为这样它会在发出START TRANSACTION
时转储数据库的一致状态,而不会阻塞任何应用程序。
When using this option, you should keep in mind that only 使用此选项时,您应该记住,只有InnoDB
tables are dumped in a consistent state. InnoDB
表才会以一致的状态转储。For example, any 例如,使用此选项时转储的任何MyISAM
or MEMORY
tables dumped while using this option may still change state.MyISAM
或MEMORY
表仍可能更改状态。
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
. --single-transaction
转储时,为了确保转储文件有效(表内容和二进制日志坐标正确),其他连接不应使用以下语句:ALTER TABLE
、CREATE TABLE
、DROP TABLE
、RENAME TABLE
、TRUNCATE TABLE
。A consistent read is not isolated from those statements, so use of them on a table to be dumped can cause the 一致性读取不是与这些语句隔离的,因此在要转储的表上使用它们可能会导致mysqlpump执行的SELECT
that is performed by mysqlpump to retrieve the table contents to obtain incorrect contents or fail.SELECT
检索表内容以获取不正确的内容或失败。
--add-locks
and --single-transaction
are mutually exclusive.--add-locks
和--single-transaction
是互斥的。
Omit 在视图和存储程序的DEFINER
and SQL SECURITY
clauses from the CREATE
statements for views and stored programs. CREATE
语句中省略DEFINER
和SQL SECURITY
子句。The dump file, when reloaded, creates objects that use the default 重新加载转储文件时,会创建使用默认DEFINER
and SQL SECURITY
values. DEFINER
和SQL SECURITY
值的对象。See Section 25.6, “Stored Object Access Control”.请参阅第25.6节,“存储对象访问控制”。
--skip-dump-rows
, -d
Do not dump table rows.不要转储表行。
--socket=
, path
-S
path
For connections to 对于与localhost
, the Unix socket file to use, or, on Windows, the name of the named pipe to use.localhost
的连接,使用Unix套接字文件,或者在Windows上,使用命名管道的名称。
On Windows, this option applies only if the server was started with the 在Windows上,此选项仅在服务器启动时启用了named_pipe
system variable enabled to support named-pipe connections. named_pipe
系统变量以支持命名管道连接时适用。In addition, the user making the connection must be a member of the Windows group specified by the 此外,进行连接的用户必须是named_pipe_full_access_group
system variable.named_pipe_full_access_group
系统变量指定的Windows组的成员。
Options that begin with 以--ssl
specify whether to connect to the server using encryption and indicate where to find SSL keys and certificates. --ssl
开头的选项指定是否使用加密连接到服务器,并指示在哪里查找SSL密钥和证书。See Command Options for Encrypted Connections.请参见加密连接的命令选项。
--ssl-fips-mode={OFF|ON|STRICT}
Controls whether to enable FIPS mode on the client side. 控制是否在客户端启用FIPS模式。The --ssl-fips-mode
option differs from other --ssl-
options in that it is not used to establish encrypted connections, but rather to affect which cryptographic operations to permit. xxx
--ssl-fips-mode
选项与其他--ssl-xxx
选项的不同之处在于,它不用于建立加密连接,而是影响允许的加密操作。See Section 6.8, “FIPS Support”.请参阅第6.8节,“FIPS支持”。
These 允许使用以下--ssl-fips-mode
values are permitted:--ssl-fips-mode
值:
OFF
: Disable FIPS mode.:禁用FIPS模式。
ON
: Enable FIPS mode.:启用FIPS模式。
STRICT
: Enable “strict” FIPS mode.:启用“严格”FIPS模式。
If the OpenSSL FIPS Object Module is not available, the only permitted value for 如果OpenSSL FIPS对象模块不可用,则--ssl-fips-mode
is OFF
. --ssl-fips-mode
的唯一允许值为OFF
。In this case, setting 在这种情况下,将--ssl-fips-mode
to ON
or STRICT
causes the client to produce a warning at startup and to operate in non-FIPS mode.--ssl-fips-mode
设置为ON
或STRICT
会导致客户端在启动时产生警告,并在非fips模式下运行。
--tls-ciphersuites=
ciphersuite_list
The permissible ciphersuites for encrypted connections that use TLSv1.3. The value is a list of one or more colon-separated ciphersuite names. 允许的密码适用于使用TLSv1.3的加密连接。该值是一个或多个冒号分隔的密码套件名称的列表。The ciphersuites that can be named for this option depend on the SSL library used to compile MySQL. 可以为此选项命名的密码套件取决于用于编译MySQL的SSL库。For details, see Section 6.3.2, “Encrypted Connection TLS Protocols and Ciphers”.有关详细信息,请参阅第6.3.2节,“加密连接TLS协议和密码”。
This option was added in MySQL 8.0.16.此选项是在MySQL 8.0.16中添加的。
The permissible TLS protocols for encrypted connections. The value is a list of one or more comma-separated protocol names. 加密连接的允许TLS协议。该值是一个或多个逗号分隔的协议名称的列表。The protocols that can be named for this option depend on the SSL library used to compile MySQL. 可以为此选项命名的协议取决于用于编译MySQL的SSL库。For details, see Section 6.3.2, “Encrypted Connection TLS Protocols and Ciphers”.有关详细信息,请参阅第6.3.2节,“加密连接TLS协议和密码”。
Include triggers for each dumped table in the output.在输出中包含每个转储表的触发器。
This option is enabled by default; use 默认情况下启用此选项;使用--skip-triggers
to disable it.--skip-triggers
禁用它。
This option enables 此选项允许在不同时区的服务器之间转储和重新加载TIMESTAMP
columns to be dumped and reloaded between servers in different time zones. TIMESTAMP
列。mysqlpump sets its connection time zone to UTC and adds mysqlpump将其连接时区设置为UTC,并将SET TIME_ZONE='+00:00'
to the dump file. SET TIME_ZONE='+00:00'
添加到转储文件中。Without this option, 如果没有此选项,TIMESTAMP
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. TIMESTAMP
列将在源服务器和目标服务器本地的时区中转储和重新加载,如果服务器位于不同的时区,这可能会导致值发生变化。--tz-utc
also protects against changes due to daylight saving time.--tz-utc
还可以防止夏令时的变化。
This option is enabled by default; use 默认情况下启用此选项;使用--skip-tz-utc
to disable it.--skip-tz-utc
禁用它。
--user=
, user_name
-u
user_name
The user name of the MySQL account to use for connecting to the server.用于连接到服务器的MySQL帐户的用户名。
Dump user accounts as logical definitions in the form of 以CREATE USER
and GRANT
statements.CREATE USER
和GRANT
语句的形式将用户帐户作为逻辑定义转储。
User definitions are stored in the grant tables in the 用户定义存储在mysql
system database. mysql
系统数据库的授权表中。By default, mysqlpump does not include the grant tables in 默认情况下,mysqlpump不在mysql
database dumps. mysql
数据库转储中包含授权表。To dump the contents of the grant tables as logical definitions, use the 要将授权表的内容作为逻辑定义转储,请使用--users
option and suppress all database dumping:--users
选项并禁止所有数据库转储:
mysqlpump --exclude-databases=% --users
--version
, -V
Display version information and exit.显示版本信息并退出。
Periodically display a progress indicator that provides information about the completed and total number of tables, rows, and other objects.定期显示进度指示器,提供有关已完成的表、行和其他对象的数量和总数的信息。
This option is enabled by default; use 默认情况下启用此选项;使用--skip-watch-progress
to disable it.--skip-watch-progress
以禁用它。
--zstd-compression-level=
level
The compression level to use for connections to the server that use the 用于连接到使用zstd
compression algorithm. The permitted levels are from 1 to 22, with larger values indicating increasing levels of compression. zstd
压缩算法的服务器的压缩级别。允许的级别为1到22,较大的值表示压缩级别增加。The default 默认的zstd
compression level is 3. The compression level setting has no effect on connections that do not use zstd
compression.zstd
压缩级别为3。压缩级别设置对不使用zstd
压缩的连接没有影响。
For more information, see Section 4.2.8, “Connection Compression Control”.有关更多信息,请参阅第4.2.8节,“连接压缩控制”。
This option was added in MySQL 8.0.18.此选项是在MySQL 8.0.18中添加的。
mysqlpump has a set of inclusion and exclusion options that enable filtering of several object types and provide flexible control over which objects to dump:mysqlpump有一组包含和排除选项,可以筛选多种对象类型,并灵活控制要转储的对象:
--include-databases
and --exclude-databases
apply to databases and all objects within them.--include-databases
和--exclude-databases
适用于数据库及其内的所有对象。
--include-tables
and --exclude-tables
apply to tables. --include-tables
和--exclude-tables
适用于表。These options also affect triggers associated with tables unless the trigger-specific options are given.除非给出了特定于触发器的选项,否则这些选项也会影响与表关联的触发器。
--include-triggers
and --exclude-triggers
apply to triggers.--include-triggers
和--exclude-triggers
适用于触发器。
--include-routines
and --exclude-routines
apply to stored procedures and functions. --include-routines
和--exclude-routines
适用于存储过程和函数。If a routine option matches a stored procedure name, it also matches a stored function of the same name.如果例程选项与存储过程名称匹配,则它也与同名存储函数匹配。
--include-events
and --exclude-events
apply to Event Scheduler events.--include-events
和--exclude-events
适用于事件计划程序事件。
--include-users
and --exclude-users
apply to user accounts.--include-users
和--exclude-users
适用于用户帐户。
Any inclusion or exclusion option may be given multiple times. The effect is additive. Order of these options does not matter.任何包含或排除选项都可以多次给出。效果是累加的。这些选项的顺序并不重要。
The value of each inclusion and exclusion option is a list of comma-separated names of the appropriate object type. For example:每个包含和排除选项的值都是相应对象类型的逗号分隔名称列表。例如:
--exclude-databases=test,world --include-tables=customer,invoice
Wildcard characters are permitted in the object names:对象名称中允许使用通配符:
%
matches any sequence of zero or more characters.%
匹配任何零个或多个字符的序列。
_
matches any single character._
匹配任何单个字符。
For example, 例如,--include-tables=t%,__tmp
matches all table names that begin with t
and all five-character table names that end with tmp
.--include-tables=t%,__tmp
匹配以t
开头的所有表名和以tmp结尾的所有五个字符的表名。
For users, a name specified without a host part is interpreted with an implied host of 对于用户,如果指定的名称没有主机部分,则将使用隐含的主机%
. %
进行解释。For example, 例如,u1
and u1@%
are equivalent. u1
和u1@%
是等价的。This is the same equivalence that applies in MySQL generally (see Section 6.2.4, “Specifying Account Names”).这与MySQL中普遍适用的等效性相同(参阅第6.2.4节,“指定帐户名”)。
Inclusion and exclusion options interact as follows:纳入和排除选项的相互作用如下:
By default, with no inclusion or exclusion options, mysqlpump dumps all databases (with certain exceptions noted in mysqlpump Restrictions).默认情况下,没有包含或排除选项,mysqlpump会转储所有数据库(mysqlpump限制中注明的某些例外情况除外)。
If inclusion options are given in the absence of exclusion options, only the objects named as included are dumped.如果在没有排除选项的情况下给出了包含选项,则只转储名为包含的对象。
If exclusion options are given in the absence of inclusion options, all objects are dumped except those named as excluded.如果在没有包含选项的情况下给出了排除选项,则会转储所有对象,但被指定为排除的对象除外。
If inclusion and exclusion options are given, all objects named as excluded and not named as included are not dumped. All other objects are dumped.如果提供了包含和排除选项,则不会转储所有名为排除和未名为包含的对象。所有其他对象都被丢弃。
If multiple databases are being dumped, it is possible to name tables, triggers, and routines in a specific database by qualifying the object names with the database name. 如果转储多个数据库,则可以通过用数据库名称限定对象名称来命名特定数据库中的表、触发器和例程。The following command dumps databases 以下命令转储数据库db1
and db2
, but excludes tables db1.t1
and db2.t2
:db1
和db2
,但不包括表db1.t1
和db2.t2
:
mysqlpump --include-databases=db1,db2 --exclude-tables=db1.t1,db2.t2
The following options provide alternative ways to specify which databases to dump:以下选项提供了指定要转储哪些数据库的替代方法:
The --all-databases
option dumps all databases (with certain exceptions noted in mysqlpump Restrictions). --all-databases
选项转储所有数据库(mysqlpump限制中注明的某些例外情况除外)。It is equivalent to specifying no object options at all (the default mysqlpump action is to dump everything).这相当于根本不指定任何对象选项(默认的mysqlpump操作是转储所有内容)。
--include-databases=%
is similar to --all-databases
, but selects all databases for dumping, even those that are exceptions for --all-databases
.--include-databases=%
类似于--all-databases
,但会选择所有数据库进行转储,即使是那些属于--all-databases
的例外。
The --databases
option causes mysqlpump to treat all name arguments as names of databases to dump. --databases
选项使mysqlpump将所有名称参数视为要转储的数据库名称。It is equivalent to an 它相当于命名相同数据库的--include-databases
option that names the same databases.--include-databases
选项。
mysqlpump can use parallelism to achieve concurrent processing. mysqlpump可以使用并行性来实现并发处理。You can select concurrency between databases (to dump multiple databases simultaneously) and within databases (to dump multiple objects from a given database simultaneously).您可以选择数据库之间(同时转储多个数据库)和数据库内部(同时转储给定数据库中的多个对象)的并发性。
By default, mysqlpump sets up one queue with two threads. You can create additional queues and control the number of threads assigned to each one, including the default queue:默认情况下,mysqlpump会设置一个包含两个线程的队列。您可以创建其他队列并控制分配给每个队列的线程数,包括默认队列:
--default-parallelism=
N
specifies the default number of threads used for each queue. In the absence of this option, 指定每个队列使用的默认线程数。如果没有这个选项,N
is 2.N
是2。
The default queue always uses the default number of threads. Additional queues use the default number of threads unless you specify otherwise.默认队列始终使用默认线程数。除非另有指定,否则其他队列将使用默认线程数。
--parallel-schemas=[
N
:]db_list
sets up a processing queue for dumping the databases named in 设置一个处理队列,用于转储db_list
and optionally specifies how many threads the queue uses. db_list
中命名的数据库,并可选择指定队列使用的线程数。db_list
is a list of comma-separated database names. db_list
是逗号分隔的数据库名称列表。If the option argument begins with 如果选项参数以
, the queue uses N
:N
threads. N:
开头,则队列使用N
个线程。Otherwise, the 否则,--default-parallelism
option determines the number of queue threads.--default-parallelism
选项将决定队列线程的数量。
Multiple instances of the --parallel-schemas
option create multiple queues.--parallel-schemas
选项的多个实例会创建多个队列。
Names in the database list are permitted to contain the same 数据库列表中的名称允许包含与筛选选项支持的%
and _
wildcard characters supported for filtering options (see mysqlpump Object Selection).%
和_
通配符相同的通配符(请参阅mysqlpump
对象选择)。
mysqlpump uses the default queue for processing any databases not named explicitly with a mysqlpump使用默认队列来处理任何未使用--parallel-schemas
option, and for dumping user definitions if command options select them.--parallel-schemas
选项显式命名的数据库,并在命令选项选择用户定义时转储用户定义。
In general, with multiple queues, mysqlpump uses parallelism between the sets of databases processed by the queues, to dump multiple databases simultaneously. 一般来说,对于多个队列,mysqlpump使用队列处理的数据库集之间的并行性,同时转储多个数据库。For a queue that uses multiple threads, mysqlpump uses parallelism within databases, to dump multiple objects from a given database simultaneously. 对于使用多个线程的队列,mysqlpump使用数据库内的并行性,从给定的数据库中同时转储多个对象。Exceptions can occur; for example, mysqlpump may block queues while it obtains from the server lists of objects in databases.可能会出现例外情况;例如,mysqlpump在从服务器获取数据库中的对象列表时可能会阻止队列。
With parallelism enabled, it is possible for output from different databases to be interleaved. For example, 启用并行性后,不同数据库的输出可以交错。例如,来自并行转储的多个表的INSERT
statements from multiple tables dumped in parallel can be interleaved; the statements are not written in any particular order. INSERT
语句可以交错;这些陈述没有按照任何特定的顺序写。This does not affect reloading because output statements qualify object names with database names or are preceded by 这不会影响重新加载,因为输出语句用数据库名称限定对象名称,或者根据需要在前面加上USE
statements as required.USE
语句。
The granularity for parallelism is a single database object. For example, a single table cannot be dumped in parallel using multiple threads.并行性的粒度是单个数据库对象。例如,不能使用多个线程并行转储单个表。
Examples:示例:
mysqlpump --parallel-schemas=db1,db2 --parallel-schemas=db3
mysqlpump sets up a queue to process mysqlpump设置了一个队列来处理db1
and db2
, another queue to process db3
, and a default queue to process all other databases. All queues use two threads.db1
和db2
,另一个队列用于处理db3
,还有一个默认队列用于处理所有其他数据库。所有队列都使用两个线程。
mysqlpump --parallel-schemas=db1,db2 --parallel-schemas=db3 --default-parallelism=4
This is the same as the previous example except that all queues use four threads.这与前面的示例相同,只是所有队列都使用四个线程。
mysqlpump --parallel-schemas=5:db1,db2 --parallel-schemas=3:db3
The queue for db1
and db2
uses five threads, the queue for db3
uses three threads, and the default queue uses the default of two threads.db1
和db2
的队列使用五个线程,db3
的队列使用三个线程,默认队列使用两个线程的默认值。
As a special case, with 作为一种特殊情况,在--default-parallelism=0
and no --parallel-schemas
options, mysqlpump runs as a single-threaded process and creates no queues.--default-parallelism=0
并且非--parallel-schemas
选项下,mysqlpump作为单线程进程运行,不创建队列。
mysqlpump does not dump the 默认情况下,mysqlpump不会转储performance_schema
, ndbinfo
, or sys
schema by default. performance_schema
、ndbinfo
或sys
模式。To dump any of these, name them explicitly on the command line. 要转储其中任何一个,请在命令行上明确命名它们。You can also name them with the 您还可以使用--databases
or --include-databases
option.--databases
或--included-databases
选项来命名它们。
mysqlpump does not dump the mysqlpump不会转储INFORMATION_SCHEMA
schema.INFORMATION_SCHEMA
架构。
mysqlpump does not dump mysqlpump不会转储InnoDB
CREATE TABLESPACE
statements.InnoDB CREATE TABLESPACE
语句。
mysqlpump dumps user accounts in logical form using mysqlpump使用CREATE USER
and GRANT
statements (for example, when you use the --include-users
or --users
option). CREATE USER
和GRANT
语句以逻辑形式转储用户帐户(例如,当您使用--include-users
或--users
选项时)。For this reason, dumps of the 因此,默认情况下,mysql
system database do not by default include the grant tables that contain user definitions: user
, db
, tables_priv
, columns_priv
, procs_priv
, or proxies_priv
. mysql
系统数据库的转储不包括包含用户定义的授权表:user
、db
、tables_priv
、columns_private
、procs_priv
或proxies_priv
。To dump any of the grant tables, name the 要转储任何授权表,请命名mysql
database followed by the table names:mysql
数据库,后跟表名:
mysqlpump mysql user db ...