8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

正文为中文,英文原文默认隐藏。点击任意中文段落即可展开 / 收起对应英文原文。

打开官方英文原文 ↗

译文由机器翻译生成,仅供理解参考;有疑问请以官方英文原文为准。

MySQL 8.4 参考手册 / 6 个 MySQL 程序 / 6.5 客户端程序 / 6.5.2 mysqladmin — MySQL 服务器管理程序
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 89%

6.5.2 mysqladmin — MySQL 服务器管理程序6.5.2 mysqladmin — A MySQL Server Administration Program

mysqladmin 是用于执行管理操作的客户端。你可以使用它来检查服务器的配置和当前状态,创建和删除数据库等。mysqladmin is a client for performing administrative operations. You can use it to check the server's configuration and current status, to create and drop databases, and more.

像这样调用 mysqladmin:Invoke mysqladmin like this:

mysqladmin [options] command [command-arg] [command [command-arg]] ...

mysqladmin 支持以下命令。部分命令在命令名称后需要带上参数。mysqladmin supports the following commands. Some of the commands take an argument following the command name.

  • create db_name create db_name

    创建一个名为 db_name 的新数据库。Create a new database named db_name.

  • debug debug

    指示服务器将调试信息写入错误日志。连接的用户必须具有 SUPER 权限。该信息的格式和内容可能会发生变化。Tells the server to write debug information to the error log. The connected user must have the SUPER privilege. Format and content of this information is subject to change.

    这包括有关事件调度器的信息。请参见 第 27.4.5 节,“事件调度器状态”。This includes information about the Event Scheduler. See Section 27.4.5, “Event Scheduler Status”.

  • drop db_name drop db_name

    删除名为 db_name 的数据库及其所有表。Delete the database named db_name and all its tables.

  • extended-status extended-status

    显示服务器状态变量及其值。Display the server status variables and their values.

  • flush-hosts flush-hosts

    刷新主机缓存中的所有信息。参见 第 7.1.12.3 节,“DNS 查询和主机缓存”。Flush all information in the host cache. See Section 7.1.12.3, “DNS Lookups and the Host Cache”.

  • flush-logs [log_type ...] flush-logs [log_type ...]

    刷新所有日志。Flush all logs.

    mysqladmin flush-logs 命令允许提供可选的日志类型,以指定要刷新哪些日志。在 flush-logs 命令之后,你可以提供一个用空格分隔的一个或多个以下日志类型的列表:binary、engine、error、general、relay、slow。这些对应于可在 FLUSH LOGS SQL 语句中指定的日志类型。The mysqladmin flush-logs command permits optional log types to be given, to specify which logs to flush. Following the flush-logs command, you can provide a space-separated list of one or more of the following log types: binary, engine, error, general, relay, slow. These correspond to the log types that can be specified for the FLUSH LOGS SQL statement.

  • flush-privileges flush-privileges

    重新加载权限表(与 reload 相同)。Reload the grant tables (same as reload).

  • flush-status flush-status

    清除状态变量。Clear status variables.

  • flush-tables flush-tables

    刷新所有表。Flush all tables.

  • kill id,id,... kill id,id,...

    终止服务器线程。如果给出了多个线程 ID 值,列表中不得有空格。Kill server threads. If multiple thread ID values are given, there must be no spaces in the list.

    要终止属于其他用户的线程,连接的用户必须拥有CONNECTION_ADMIN权限(或已弃用的SUPER权限)。To kill threads belonging to other users, the connected user must have the CONNECTION_ADMIN privilege (or the deprecated SUPER privilege).

  • password new_password password new_password

    设置一个新密码。这会将密码更改为 new_password,用于你通过 mysqladmin 连接服务器的账户。因此,下次你使用同一账户调用 mysqladmin(或任何其他客户端程序)时,必须指定新密码。Set a new password. This changes the password to new_password for the account that you use with mysqladmin for connecting to the server. Thus, the next time you invoke mysqladmin (or any other client program) using the same account, you must specify the new password.

    Warning

    使用 mysqladmin 设置密码应被认为是 不安全的。在某些系统上,您的密码可能会被系统状态程序(如 ps)看到,这些程序可能会被其他用户调用以显示命令行。MySQL 客户端通常在初始化过程中将命令行密码参数覆盖为零。然而,仍然存在一个短暂的时间间隔,在此期间密码值是可见的。此外,在某些系统上,这种覆盖策略无效,密码仍然对 ps 可见。(SystemV Unix 系统以及可能的其他系统都存在此问题。)Setting a password using mysqladmin should be considered insecure. On some systems, your password becomes visible to system status programs such as ps that may be invoked by other users to display command lines. MySQL clients typically overwrite the command-line password argument with zeros during their initialization sequence. However, there is still a brief interval during which the value is visible. Also, on some systems this overwriting strategy is ineffective and the password remains visible to ps. (SystemV Unix systems and perhaps others are subject to this problem.)

    如果 new_password 值包含空格或其他对您的命令解释器特殊的字符,则需要将其用引号括起来。在 Windows 上,请务必使用双引号而不是单引号;单引号不会从密码中去掉,而是被解释为密码的一部分。例如:If the new_password value contains spaces or other characters that are special to your command interpreter, you need to enclose it within quotation marks. On Windows, be sure to use double quotation marks rather than single quotation marks; single quotation marks are not stripped from the password, but rather are interpreted as part of the password. For example:

    mysqladmin password "my new password"
    

    在 password 命令之后可以省略新密码。在这种情况下,mysqladmin 会提示输入密码值,这样可以避免在命令行中指定密码。只有在 password 是 mysqladmin 命令行中的最后一个命令时,才应该省略密码值。否则,下一个参数会被视为密码。The new password can be omitted following the password command. In this case, mysqladmin prompts for the password value, which enables you to avoid specifying the password on the command line. Omitting the password value should be done only if password is the final command on the mysqladmin command line. Otherwise, the next argument is taken as the password.

    Caution

    如果服务器是使用--skip-grant-tables选项启动的,请不要使用此命令。密码不会更改。即使你在同一命令行中在password命令前加上flush-privileges以重新启用授权表,这也依然成立,因为刷新操作是在你连接之后发生的。不过,你可以使用mysqladmin flush-privileges来重新启用授权表,然后再使用单独的mysqladmin password命令来更改密码。Do not use this command used if the server was started with the --skip-grant-tables option. No password change is applied. This is true even if you precede the password command with flush-privileges on the same command line to re-enable the grant tables because the flush operation occurs after you connect. However, you can use mysqladmin flush-privileges to re-enable the grant tables and then use a separate mysqladmin password command to change the password.

  • ping

    检查服务器是否可用。来自 mysqladmin 的返回状态为 0 表示服务器正在运行,为 1 表示服务器未运行。即使发生诸如 Access denied 等错误,返回值也为 0,因为这意味着服务器正在运行,但拒绝了连接,这与服务器未运行不同。Check whether the server is available. The return status from mysqladmin is 0 if the server is running, 1 if it is not. This is 0 even in case of an error such as Access denied, because this means that the server is running but refused the connection, which is different from the server not running.

  • processlist processlist

    显示活动服务器线程的列表。这类似于 SHOW PROCESSLIST 语句的输出。如果提供了 --verbose 选项,输出类似于 SHOW FULL PROCESSLIST。 (参见 第 15.7.7.31 节,“SHOW PROCESSLIST 语句”.)Show a list of active server threads. This is like the output of the SHOW PROCESSLIST statement. If the --verbose option is given, the output is like that of SHOW FULL PROCESSLIST. (See Section 15.7.7.31, “SHOW PROCESSLIST Statement”.)

  • reload reload

    重新加载授权表。Reload the grant tables.

  • refresh refresh

    刷新所有表并关闭和打开日志文件。Flush all tables and close and open log files.

  • shutdown shutdown

    停止服务器。Stop the server.

  • start-replica start-replica

    在副本服务器上启动复制。Start replication on a replica server.

  • start-slave start-slave

    这是 start-replica 的已弃用别名。This is a deprecated alias for start-replica.

  • status status

    显示简短的服务器状态信息。Display a short server status message.

  • stop-replica stop-replica

    停止在副本服务器上的复制。Stop replication on a replica server.

  • stop-slave stop-slave

    这是 stop-replica 的已弃用别名。This is a deprecated alias for stop-replica.

  • variables variables

    显示服务器系统变量及其值。Display the server system variables and their values.

  • version version

    显示服务器的版本信息。Display version information from the server.

所有命令都可以缩短为任何唯一前缀。例如:All commands can be shortened to any unique prefix. For example:

$> mysqladmin proc stat
+----+-------+-----------+----+---------+------+-------+------------------+
| Id | User  | Host      | db | Command | Time | State | Info             |
+----+-------+-----------+----+---------+------+-------+------------------+
| 51 | jones | localhost |    | Query   | 0    |       | show processlist |
+----+-------+-----------+----+---------+------+-------+------------------+
Uptime: 1473624  Threads: 1  Questions: 39487
Slow queries: 0  Opens: 541  Flush tables: 1
Open tables: 19  Queries per second avg: 0.0268

mysqladmin status 命令结果显示以下值:The mysqladmin status command result displays the following values:

  • Uptime Uptime

    MySQL 服务器已经运行的秒数。The number of seconds the MySQL server has been running.

  • Threads Threads

    活动线程(客户端)的数量。The number of active threads (clients).

  • Questions Questions

    自服务器启动以来,客户端提出的问题(查询)数量。The number of questions (queries) from clients since the server was started.

  • Slow queries Slow queries

    执行时间超过 long_query_time 秒的查询数量。参见 第 7.4.5 节,“慢查询日志”。The number of queries that have taken more than long_query_time seconds. See Section 7.4.5, “The Slow Query Log”.

  • Opens Opens

    服务员已开设的桌子数量。The number of tables the server has opened.

  • Flush tables Flush tables

    服务器已执行的 flush-*、refresh 和 reload 命令的数量。The number of flush-*, refresh, and reload commands the server has executed.

  • Open tables Open tables

    当前打开的桌子数量。The number of tables that currently are open.

如果您在使用 Unix 套接字文件连接到本地服务器时执行 mysqladmin shutdown,mysqladmin 会等待直到服务器的进程 ID 文件被删除,以确保服务器已正确停止。If you execute mysqladmin shutdown when connecting to a local server using a Unix socket file, mysqladmin waits until the server's process ID file has been removed, to ensure that the server has stopped properly.

mysqladmin 支持以下选项,这些选项可以在命令行上指定,也可以在选项文件的 [mysqladmin] 和 [client] 分组中指定。有关 MySQL 程序使用的选项文件的信息,请参见 第 6.2.2.2 节,“使用选项文件”。mysqladmin supports the following options, which can be specified on the command line or in the [mysqladmin] and [client] groups of an option file. For information about option files used by MySQL programs, see Section 6.2.2.2, “Using Option Files”.

表 6.11 mysqladmin 选项Table 6.11 mysqladmin Options

选项名称Option Name 说明Description
--绑定地址--bind-address 使用指定的网络接口连接到 MySQL 服务器Use specified network interface to connect to MySQL Server
--字符集目录--character-sets-dir 可以找到字符集的目录Directory where character sets can be found
--压缩--compress 压缩客户端和服务器之间发送的所有信息Compress all information sent between client and server
--压缩算法--compression-algorithms 允许用于连接服务器的压缩算法Permitted compression algorithms for connections to server
--连接超时--connect-timeout 连接超时前的秒数Number of seconds before connection timeout
--计数--count 重复命令执行的迭代次数Number of iterations to make for repeated command execution
--调试--debug 写调试日志Write debugging log
--调试检查--debug-check 程序退出时打印调试信息Print debugging information when program exits
--调试信息--debug-info 在程序退出时打印调试信息、内存和 CPU 统计信息Print debugging information, memory, and CPU statistics when program exits
--默认认证--default-auth 要使用的身份验证插件Authentication plugin to use
--默认字符集--default-character-set 指定默认字符集Specify default character set
--defaults-extra-file(额外默认文件)--defaults-extra-file 除了常规选项文件外,读取指定名称的选项文件Read named option file in addition to usual option files
--defaults-file(默认文件)--defaults-file 仅读取指定的选项文件Read only named option file
--defaults-group-suffix(默认组后缀)--defaults-group-suffix 选项组后缀值Option group suffix value
--enable-cleartext-plugin(启用明文插件)--enable-cleartext-plugin 启用明文身份验证插件Enable cleartext authentication plugin
--强制--force 即使发生 SQL 错误也继续Continue even if an SQL error occurs
--获取服务器公钥--get-server-public-key 从服务器请求 RSA 公钥Request RSA public key from server
--帮助--help 显示帮助信息并退出Display help message and exit
--主机--host MySQL 服务器所在的主机Host on which MySQL server is located
--登录路径--login-path 从 .mylogin.cnf 读取登录路径选项Read login path options from .mylogin.cnf
--无蜂鸣--no-beep 发生错误时不要发出哔声Do not beep when errors occur
--无默认值--no-defaults 不读取任何选项文件Read no option files
--无登录路径--no-login-paths 不要从登录路径文件中读取登录路径Do not read login paths from the login path file
--密码--password 连接服务器时使用的密码Password to use when connecting to server
--密码 1--password1 首次多因素身份验证密码,用于连接服务器First multifactor authentication password to use when connecting to server
--密码 2--password2 连接服务器时使用的第二个多因素认证密码Second multifactor authentication password to use when connecting to server
--密码 3--password3 连接服务器时使用的第三个多因素认证密码Third multifactor authentication password to use when connecting to server
--管道--pipe 使用命名管道连接到服务器(仅限 Windows)Connect to server using named pipe (Windows only)
--插件目录--plugin-dir 插件安装的目录Directory where plugins are installed
--端口--port 连接的 TCP/IP 端口号TCP/IP port number for connection
--打印默认值--print-defaults 打印默认选项Print default options
--协议--protocol 要使用的传输协议Transport protocol to use
--相对--relative 在与 --sleep 选项一起使用时显示当前值与先前值的差异Show the difference between the current and previous values when used with the --sleep option
--server-public-key-path(服务器公钥路径)--server-public-key-path 包含 RSA 公钥的文件路径名称Path name to file containing RSA public key
--shared-memory-base-name(共享内存基本名称)--shared-memory-base-name 共享内存连接的共享内存名称(仅限 Windows)Shared-memory name for shared-memory connections (Windows only)
--show-warnings(显示警告)--show-warnings 在语句执行后显示警告Show warnings after statement execution
--关闭超时--shutdown-timeout 等待服务器关闭的最大秒数The maximum number of seconds to wait for server shutdown
--静默--silent 静音模式Silent mode
--休眠--sleep 重复执行命令,每次之间暂停指定的秒数Execute commands repeatedly, sleeping for delay seconds in between
--socket 要使用的 Unix 套接字文件或 Windows 命名管道Unix socket file or Windows named pipe to use
--ssl-ca 包含受信任的 SSL 证书颁发机构列表的文件File that contains list of trusted SSL Certificate Authorities
--ssl-capath 包含受信任的 SSL 证书颁发机构证书文件的目录Directory that contains trusted SSL Certificate Authority certificate files
--ssl-cert 包含 X.509 证书的文件File that contains X.509 certificate
--ssl-cipher 连接加密的允许密码Permissible ciphers for connection encryption
--ssl-crl 包含证书吊销列表的文件File that contains certificate revocation lists
--ssl-crlpath 包含证书吊销列表文件的目录Directory that contains certificate revocation-list files
--ssl-fips-mode 是否在客户端启用 FIPS 模式Whether to enable FIPS mode on client side
--ssl-key 包含 X.509 密钥的文件File that contains X.509 key
--ssl-mode 与服务器连接的期望安全状态Desired security state of connection to server
--ssl-session-data 包含 SSL 会话数据的文件File that contains SSL session data
--ssl-session-data-continue-on-failed-reuse 如果会话重用失败,是否建立连接Whether to establish connections if session reuse fails
--tls-加密套件--tls-ciphersuites 允许的用于加密连接的 TLSv1.3 加密套件Permissible TLSv1.3 ciphersuites for encrypted connections
--tls-sni-服务器名--tls-sni-servername 由客户端提供的服务器名称Server name supplied by the client
--tls-版本--tls-version 允许用于加密连接的 TLS 协议Permissible TLS protocols for encrypted connections
--用户--user 连接服务器时使用的 MySQL 用户名MySQL user name to use when connecting to server
--详细--verbose 详细模式Verbose mode
--版本--version 显示版本信息并退出Display version information and exit
--垂直--vertical 垂直打印查询输出行(每列值一行)Print query output rows vertically (one line per column value)
--等待--wait 如果无法建立连接,请等待并重试,而不是中止If the connection cannot be established, wait and retry instead of aborting
--zstd-压缩级别--zstd-compression-level 用于与服务器进行 zstd 压缩连接的压缩级别Compression level for connections to server that use zstd compression

  • --help, -? --help, -?

    命令行格式Command-Line Format --help--help

    显示帮助信息并退出。Display a help message and exit.

  • --bind-address=ip_address

    命令行格式Command-Line Format --bind-address=ip_address--bind-address=ip_address

    在具有多个网络接口的计算机上,使用此选项选择用于连接到 MySQL 服务器的接口。On a computer having multiple network interfaces, use this option to select which interface to use for connecting to the MySQL server.

  • --character-sets-dir=dir_name

    命令行格式Command-Line Format --character-sets-dir=path--character-sets-dir=path
    类型Type 字符串String
    默认值Default Value [none][none]

    安装字符集的目录。请参见第 12.15 节,“字符集配置”。The directory where character sets are installed. See Section 12.15, “Character Set Configuration”.

  • --compress, -C

    命令行格式Command-Line Format --compress[={OFF|ON}]--compress[={OFF|ON}]
    已弃用Deprecated 是Yes
    类型Type 布尔Boolean
    默认值Default Value OFFOFF

    如果可能,压缩客户端与服务器之间发送的所有信息。参见 第 6.2.8 节,“连接压缩控制”。Compress all information sent between the client and the server if possible. See Section 6.2.8, “Connection Compression Control”.

    此选项已被弃用。预计将在 MySQL 的未来版本中移除。请参阅 配置遗留连接压缩。This option is deprecated. Expect it to be removed in a future version of MySQL. See Configuring Legacy Connection Compression.

  • --compression-algorithms=value --compression-algorithms=value

    命令行格式Command-Line Format --compression-algorithms=value--compression-algorithms=value
    类型Type 设置Set
    默认值Default Value uncompresseduncompressed
    有效值Valid Values

    zlib

    zstd

    uncompresseduncompressed

    允许用于与服务器连接的压缩算法。可用算法与 protocol_compression_algorithms 系统变量的算法相同。默认值为 uncompressed。The permitted compression algorithms for connections to the server. The available algorithms are the same as for the protocol_compression_algorithms system variable. The default value is uncompressed.

    更多信息,请参阅 第 6.2.8 节,“连接压缩控制”。For more information, see Section 6.2.8, “Connection Compression Control”.

  • --connect-timeout=value --connect-timeout=value

    命令行格式Command-Line Format --connect-timeout=value--connect-timeout=value
    类型Type 数字Numeric
    默认值Default Value 43200

    连接超时前的最长秒数。默认值为 43200 秒(12 小时)。The maximum number of seconds before connection timeout. The default value is 43200 (12 hours).

  • --count=N, -c N

    命令行格式Command-Line Format --count=#

    如果提供了 --sleep 选项,则重复执行命令的迭代次数。The number of iterations to make for repeated command execution if the --sleep option is given.

  • --debug[=debug_options], -# [debug_options]

    命令行格式Command-Line Format --debug[=debug_options]--debug[=debug_options]
    类型Type 字符串String
    默认值Default Value d:t:o,/tmp/mysqladmin.trace

    编写调试日志。一个典型的 debug_options 字符串是 d:t:o,file_name。默认值是 d:t:o,/tmp/mysqladmin.trace。Write a debugging log. A typical debug_options string is d:t:o,file_name. The default is d:t:o,/tmp/mysqladmin.trace.

    此选项仅在 MySQL 使用 WITH_DEBUG 构建时可用。Oracle 提供的 MySQL 发行版二进制文件 未 使用此选项构建。This option is available only if MySQL was built using WITH_DEBUG. MySQL release binaries provided by Oracle are not built using this option.

  • --debug-check

    命令行格式Command-Line Format --debug-check
    类型Type 布尔Boolean
    默认值Default Value FALSE

    程序退出时打印一些调试信息。Print some debugging information when the program exits.

    此选项仅在 MySQL 使用 WITH_DEBUG 构建时可用。Oracle 提供的 MySQL 发行版二进制文件 未 使用此选项构建。This option is available only if MySQL was built using WITH_DEBUG. MySQL release binaries provided by Oracle are not built using this option.

  • --debug-info

    命令行格式Command-Line Format --debug-info
    类型Type 布尔Boolean
    默认值Default Value FALSE

    在程序退出时打印调试信息以及内存和 CPU 使用情况统计。Print debugging information and memory and CPU usage statistics when the program exits.

    此选项仅在 MySQL 使用 WITH_DEBUG 构建时可用。Oracle 提供的 MySQL 发行版二进制文件 未 使用此选项构建。This option is available only if MySQL was built using WITH_DEBUG. MySQL release binaries provided by Oracle are not built using this option.

  • --default-auth=plugin --default-auth=plugin

    命令行格式Command-Line Format --default-auth=plugin--default-auth=plugin
    类型Type 字符串String

    关于使用哪种客户端身份验证插件的提示。请参见 第 8.2.17 节,“可插拔身份验证”。A hint about which client-side authentication plugin to use. See Section 8.2.17, “Pluggable Authentication”.

  • --default-character-set=charset_name --default-character-set=charset_name

    命令行格式Command-Line Format --default-character-set=charset_name--default-character-set=charset_name
    类型Type 字符串String

    使用 charset_name 作为默认字符集。请参见 第 12.15 节,“字符集配置”。Use charset_name as the default character set. See Section 12.15, “Character Set Configuration”.

  • --defaults-extra-file=file_name --defaults-extra-file=file_name

    命令行格式Command-Line Format --defaults-extra-file=file_name--defaults-extra-file=file_name
    类型Type 文件名File name

    在全局选项文件之后读取此选项文件,但(在 Unix 系统上)在用户选项文件之前。如果该文件不存在或无法访问,将发生错误。如果 file_name 不是绝对路径名,则相对于当前目录解释。Read this option file after the global option file but (on Unix) before the user 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.

    有关此选项文件选项及其他选项文件选项的更多信息,请参见 第 6.2.2.3 节,“影响选项文件处理的命令行选项”。For additional information about this and other option-file options, see Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”.

  • --defaults-file=file_name --defaults-file=file_name

    命令行格式Command-Line Format --defaults-file=file_name--defaults-file=file_name
    类型Type 文件名File name

    仅使用指定的选项文件。如果文件不存在或无法访问,将会发生错误。如果file_name不是绝对路径名,则将其相对于当前目录解释。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.

    例外:即使使用--defaults-file,客户端程序仍会读取.mylogin.cnf。Exception: Even with --defaults-file, client programs read .mylogin.cnf.

    有关此选项文件选项及其他选项文件选项的更多信息,请参见 第 6.2.2.3 节,“影响选项文件处理的命令行选项”。For additional information about this and other option-file options, see Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”.

  • --defaults-group-suffix=str --defaults-group-suffix=str

    命令行格式Command-Line Format --defaults-group-suffix=str--defaults-group-suffix=str
    类型Type 字符串String

    不仅读取常规的选项组,还读取具有常规名称并带有 str 后缀的组。例如,mysqladmin 通常会读取 [client] 和 [mysqladmin] 组。如果此选项以 --defaults-group-suffix=_other 的形式给出,mysqladmin 还会读取 [client_other] 和 [mysqladmin_other] 组。Read not only the usual option groups, but also groups with the usual names and a suffix of str. For example, mysqladmin normally reads the [client] and [mysqladmin] groups. If this option is given as --defaults-group-suffix=_other, mysqladmin also reads the [client_other] and [mysqladmin_other] groups.

    有关此选项文件选项及其他选项文件选项的更多信息,请参见 第 6.2.2.3 节,“影响选项文件处理的命令行选项”。For additional information about this and other option-file options, see Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”.

  • --enable-cleartext-plugin

    命令行格式Command-Line Format --enable-cleartext-plugin
    类型Type 布尔Boolean
    默认值Default Value FALSE

    启用 mysql_clear_password 明文身份验证插件。(参见 第 8.4.1.4 节,“客户端明文可插拔身份验证”。)Enable the mysql_clear_password cleartext authentication plugin. (See Section 8.4.1.4, “Client-Side Cleartext Pluggable Authentication”.)

  • --force, -f

    命令行格式Command-Line Format --force

    对于 drop db_name 命令不要请求确认。在执行多个命令时,即使发生错误也继续。Do not ask for confirmation for the drop db_name command. With multiple commands, continue even if an error occurs.

  • --get-server-public-key

    命令行格式Command-Line Format --get-server-public-key--get-server-public-key
    类型Type 布尔Boolean

    向服务器请求用于基于 RSA 密钥对的密码交换所需的公钥。此选项适用于使用 caching_sha2_password 身份验证插件进行身份验证的客户端。对于该插件,服务器不会发送公钥,除非被请求。对于未使用该插件进行身份验证的账户,此选项将被忽略。当未使用基于 RSA 的密码交换时(例如客户端使用安全连接连接服务器时),此选项也将被忽略。Request from the server the public key required for RSA key pair-based password exchange. This option applies to clients that authenticate with the caching_sha2_password authentication plugin. 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.

    如果提供了 --server-public-key-path=file_name 并指定了有效的公钥文件,则该选项优先于 --get-server-public-key。If --server-public-key-path=file_name is given and specifies a valid public key file, it takes precedence over --get-server-public-key.

    有关 caching_sha2_password 插件的信息,请参见 第 8.4.1.2 节,“缓存 SHA-2 可插拔认证”。For information about the caching_sha2_password plugin, see Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”.

  • --host=host_name, -h host_name --host=host_name, -h host_name

    命令行格式Command-Line Format --host=host_name--host=host_name
    类型Type 字符串String
    默认值Default Value localhostlocalhost

    连接到给定主机上的 MySQL 服务器。Connect to the MySQL server on the given host.

  • --login-path=name --login-path=name

    命令行格式Command-Line Format --login-path=name--login-path=name
    类型Type 字符串String

    从名为登录路径的 .mylogin.cnf 登录路径文件中读取选项。“登录路径” 是一个选项组,包含指定要连接哪个 MySQL 服务器以及以哪个帐户进行身份验证的选项。要创建或修改登录路径文件,请使用 mysql_config_editor 工具。参见 第 6.6.7 节,“mysql_config_editor — MySQL 配置工具”。Read options from the named login path in the .mylogin.cnf login path file. A “login path” is an option group containing options that specify which MySQL server to connect to and which account to authenticate as. To create or modify a login path file, use the mysql_config_editor utility. See Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”.

    有关此选项文件选项及其他选项文件选项的更多信息,请参见 第 6.2.2.3 节,“影响选项文件处理的命令行选项”。For additional information about this and other option-file options, see Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”.

  • --no-login-paths

    命令行格式Command-Line Format --no-login-paths

    跳过从登录路径文件读取选项。Skips reading options from the login path file.

    有关信息,请参见 --login-path。See --login-path for related information.

    有关此选项文件选项及其他选项文件选项的更多信息,请参见 第 6.2.2.3 节,“影响选项文件处理的命令行选项”。For additional information about this and other option-file options, see Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”.

  • --no-beep, -b

    命令行格式Command-Line Format --no-beep

    抑制默认情况下因错误(例如无法连接到服务器)而发出的警告蜂鸣声。Suppress the warning beep that is emitted by default for errors such as a failure to connect to the server.

  • --no-defaults

    命令行格式Command-Line Format --no-defaults--no-defaults

    不读取任何选项文件。如果程序启动由于从选项文件中读取未知选项而失败,可以使用 --no-defaults 来阻止它们被读取。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.

    例外情况是,如果存在,.mylogin.cnf 文件在所有情况下都会被读取。这允许以比命令行更安全的方式指定密码,即使使用了 --no-defaults。要创建 .mylogin.cnf,请使用 mysql_config_editor 工具。参见 第 6.6.7 节,“mysql_config_editor — MySQL 配置工具”。The exception is that the .mylogin.cnf file is read in all cases, if it exists. This permits passwords to be specified in a safer way than on the command line even when --no-defaults is used. To create .mylogin.cnf, use the mysql_config_editor utility. See Section 6.6.7, “mysql_config_editor — MySQL Configuration Utility”.

    有关此选项文件选项及其他选项文件选项的更多信息,请参见 第 6.2.2.3 节,“影响选项文件处理的命令行选项”。For additional information about this and other option-file options, see Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”.

  • --password[=password], -p[password] --password[=password], -p[password]

    命令行格式Command-Line Format --password[=password]--password[=password]
    类型Type 字符串String

    用于连接到服务器的 MySQL 账户的密码。密码值是可选的。如果未提供,mysqladmin 会提示输入密码。如果提供了,--password= 或 -p 与其后的密码之间 不能有空格。如果未指定密码选项,默认情况下不发送密码。The password of the MySQL account used for connecting to the server. The password value is optional. If not given, mysqladmin prompts for one. If given, there must be no space between --password= or -p and the password following it. If no password option is specified, the default is to send no password.

    在命令行中指定密码应被视为不安全。为了避免在命令行中输入密码,请使用选项文件。请参阅 第 8.1.2.1 节,“终端用户密码安全指南”。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 8.1.2.1, “End-User Guidelines for Password Security”.

    要明确指定没有密码,并且 mysqladmin 不应提示输入密码,请使用 --skip-password 选项。To explicitly specify that there is no password and that mysqladmin should not prompt for one, use the --skip-password option.

  • --password1[=pass_val]

    用于连接服务器的 MySQL 帐户的多因素认证因素 1 的密码。密码值是可选的。如果未提供,mysql 会提示输入密码。如果提供,则 --password1= 和随后的密码之间 不能有空格。如果未指定密码选项,则默认是不发送密码。The password for multifactor authentication factor 1 of the MySQL account used for connecting to the server. The password value is optional. If not given, mysql prompts for one. If given, there must be no space between --password1= and the password following it. If no password option is specified, the default is to send no password.

    在命令行中指定密码应被视为不安全。为了避免在命令行中输入密码,请使用选项文件。请参阅 第 8.1.2.1 节,“终端用户密码安全指南”。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 8.1.2.1, “End-User Guidelines for Password Security”.

    要明确指定没有密码,并且 mysqladmin 不应该提示输入密码,请使用 --skip-password1 选项。To explicitly specify that there is no password and that mysqladmin should not prompt for one, use the --skip-password1 option.

    --password1 和 --password 是同义的,--skip-password1 和 --skip-password 也是同义的。--password1 and --password are synonymous, as are --skip-password1 and --skip-password.

  • --password2[=pass_val]

    用于连接服务器的 MySQL 账户的多因素认证第二因子的密码。此选项的语义与 --password1 的语义类似;详情请参见该选项的描述。The password for multifactor authentication factor 2 of the MySQL account used for connecting to the server. The semantics of this option are similar to the semantics for --password1; see the description of that option for details.

  • --password3[=pass_val]

    用于连接服务器的 MySQL 账户的多因素认证第三因素的密码。此选项的语义类似于 --password1 的语义;详细信息请参见该选项的描述。The password for multifactor authentication factor 3 of the MySQL account used for connecting to the server. The semantics of this option are similar to the semantics for --password1; see the description of that option for details.

  • --pipe, -W

    命令行格式Command-Line Format --pipe
    类型Type 字符串String

    在 Windows 上,通过命名管道连接到服务器。此选项仅在服务器启动时已启用 named_pipe 系统变量以支持命名管道连接的情况下适用。此外,进行连接的用户必须是由 named_pipe_full_access_group 系统变量指定的 Windows 组的成员。On Windows, connect to the server using a named pipe. This option applies only if the server was started with the named_pipe system variable enabled to support named-pipe connections. 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.

  • --plugin-dir=dir_name

    命令行格式Command-Line Format --plugin-dir=dir_name--plugin-dir=dir_name
    类型Type 目录名称Directory name

    查找插件的目录。如果使用 --default-auth 选项指定认证插件,但 mysqladmin 未找到该插件,请指定此选项。参见 第 8.2.17 节,“可插拔认证”。The directory in which to look for plugins. Specify this option if the --default-auth option is used to specify an authentication plugin but mysqladmin does not find it. See Section 8.2.17, “Pluggable Authentication”.

  • --port=port_num, -P port_num

    命令行格式Command-Line Format --port=port_num--port=port_num
    类型Type 数字Numeric
    默认值Default Value 3306

    对于 TCP/IP 连接,要使用的端口号。For TCP/IP connections, the port number to use.

  • --print-defaults 显示默认值 --print-defaults

    命令行格式Command-Line Format --print-defaults

    打印程序名称以及它从选项文件中获取的所有选项。Print the program name and all options that it gets from option files.

    有关此选项文件选项及其他选项文件选项的更多信息,请参见 第 6.2.2.3 节,“影响选项文件处理的命令行选项”。For additional information about this and other option-file options, see Section 6.2.2.3, “Command-Line Options that Affect Option-File Handling”.

  • --protocol={TCP|SOCKET|PIPE|MEMORY} 指定协议 --protocol={TCP|SOCKET|PIPE|MEMORY}

    命令行格式Command-Line Format --protocol=type--protocol=type
    类型Type 字符串String
    默认值Default Value [see text][see text]
    有效值Valid Values

    TCP

    SOCKETSOCKET

    PIPEPIPE

    MEMORYMEMORY

    用于连接服务器的传输协议。当其他连接参数通常导致使用的协议不是您想要的协议时,这很有用。有关允许值的详细信息,请参阅第 6.2.7 节,“连接传输协议”。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 6.2.7, “Connection Transport Protocols”.

  • --relative, -r 相对模式 --relative, -r

    命令行格式Command-Line Format --relative 相对模式--relative

    当与 --sleep 选项一起使用时,显示当前值与前一个值之间的差异。此选项仅适用于 extended-status 命令。Show the difference between the current and previous values when used with the --sleep option. This option works only with the extended-status command.

  • --server-public-key-path=file_name --server-public-key-path=file_name

    命令行格式Command-Line Format --server-public-key-path=file_name--server-public-key-path=file_name
    类型Type 文件名File name

    包含服务器所需的 RSA 密钥对密码交换的客户端副本公钥的 PEM 格式文件的路径名。此选项适用于使用 sha256_password(已弃用)或 caching_sha2_password 身份验证插件进行身份验证的客户端。对于不使用这些插件之一进行身份验证的帐户,将忽略此选项。如果未使用基于 RSA 的密码交换(例如客户端使用安全连接连接到服务器的情况),此选项也将被忽略。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. This option applies to clients that authenticate with the sha256_password (deprecated) or caching_sha2_password authentication plugin. 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.

    如果提供了 --server-public-key-path=file_name 并指定了有效的公钥文件,则该选项优先于 --get-server-public-key。If --server-public-key-path=file_name is given and specifies a valid public key file, it takes precedence over --get-server-public-key.

    对于 sha256_password(已弃用),此选项仅在 MySQL 使用 OpenSSL 构建时才适用。For sha256_password (deprecated), this option applies only if MySQL was built using OpenSSL.

    有关 sha256_password 和 caching_sha2_password 插件的信息,请参见 第 8.4.1.3 节,“SHA-256 可插拔认证” 和 第 8.4.1.2 节,“缓存 SHA-2 可插拔认证”。For information about the sha256_password and caching_sha2_password plugins, see Section 8.4.1.3, “SHA-256 Pluggable Authentication”, and Section 8.4.1.2, “Caching SHA-2 Pluggable Authentication”.

  • --shared-memory-base-name=name --shared-memory-base-name=name

    命令行格式Command-Line Format --shared-memory-base-name=name--shared-memory-base-name=name
    特定平台Platform Specific 窗口Windows

    在 Windows 上,通过共享内存连接到本地服务器时使用的共享内存名称。默认值是 MYSQL。共享内存名称区分大小写。On Windows, the shared-memory name to use for connections made using shared memory to a local server. The default value is MYSQL. The shared-memory name is case-sensitive.

    此选项仅在服务器启用了 shared_memory 系统变量以支持共享内存连接时适用。This option applies only if the server was started with the shared_memory system variable enabled to support shared-memory connections.

  • --show-warnings 显示警告 --show-warnings

    命令行格式Command-Line Format --show-warnings--show-warnings

    显示由发送到服务器的语句执行引发的警告。Show warnings resulting from execution of statements sent to the server.

  • --shutdown-timeout=value --shutdown-timeout=value

    命令行格式Command-Line Format --shutdown-timeout=seconds--shutdown-timeout=seconds
    类型Type 数字Numeric
    默认值Default Value 3600

    等待服务器关闭的最长时间(秒)。默认值为 3600 秒(1 小时)。The maximum number of seconds to wait for server shutdown. The default value is 3600 (1 hour).

  • --silent, -s 静默模式 --silent, -s

    命令行格式Command-Line Format --silent

    如果无法建立与服务器的连接,请静默退出。Exit silently if a connection to the server cannot be established.

  • --sleep=delay, -i delay --sleep=delay, -i delay

    命令行格式Command-Line Format --sleep=delay--sleep=delay

    重复执行命令,每次执行之间等待 delay 秒。--count 选项确定循环次数。如果未指定 --count,mysqladmin 将无限执行命令,直到被中断。Execute commands repeatedly, sleeping for delay seconds in between. The --count option determines the number of iterations. If --count is not given, mysqladmin executes commands indefinitely until interrupted.

  • --socket=path, -S path --socket=path, -S path

    命令行格式Command-Line Format --socket={file_name|pipe_name}--socket={file_name|pipe_name}
    类型Type 字符串String

    用于连接localhost时,使用的 Unix 套接字文件,或者在 Windows 上使用的命名管道的名称。For connections to localhost, the Unix socket file to use, or, on Windows, the name of the named pipe to use.

    在 Windows 上,此选项仅在服务器启用支持命名管道连接的 named_pipe 系统变量启动时才适用。此外,进行连接的用户必须是由 named_pipe_full_access_group 系统变量指定的 Windows 组的成员。On Windows, this option applies only if the server was started with the named_pipe system variable enabled to support named-pipe connections. 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.

  • --ssl*

    以--ssl开头的选项指定是否使用加密连接到服务器,并指示在哪里可以找到 SSL 密钥和证书。请参阅 加密连接的命令选项。Options that begin with --ssl specify whether to connect to the server using encryption and indicate where to find SSL keys and certificates. See Command Options for Encrypted Connections.

  • --ssl-fips-mode={OFF|ON|STRICT} --ssl-fips-mode={OFF|ON|STRICT}

    命令行格式Command-Line Format --ssl-fips-mode={OFF|ON|STRICT}--ssl-fips-mode={OFF|ON|STRICT}
    已弃用Deprecated 是Yes
    类型Type 枚举Enumeration
    默认值Default Value OFFOFF
    有效值Valid Values

    OFFOFF

    ONON

    STRICTSTRICT

    控制是否在客户端启用 FIPS 模式。--ssl-fips-mode 选项不同于其他 --ssl-xxx 选项,因为它不是用于建立加密连接,而是用于影响允许哪些加密操作。参见 第 8.8 节,“FIPS 支持”。Controls whether to enable FIPS mode on the client side. The --ssl-fips-mode option differs from other --ssl-xxx options in that it is not used to establish encrypted connections, but rather to affect which cryptographic operations to permit. See Section 8.8, “FIPS Support”.

    允许使用以下 --ssl-fips-mode 值:These --ssl-fips-mode values are permitted:

    • OFF:禁用 FIPS 模式。OFF: Disable FIPS mode.

    • ON:启用 FIPS 模式。ON: Enable FIPS mode.

    • STRICT:启用“严格” FIPS 模式。STRICT: Enable “strict” FIPS mode.

    Note

    如果 OpenSSL FIPS 对象模块不可用,--ssl-fips-mode 唯一允许的值是 OFF。在这种情况下,将 --ssl-fips-mode 设置为 ON 或 STRICT 将导致客户端在启动时产生警告,并以非 FIPS 模式运行。If the OpenSSL FIPS Object Module is not available, the only permitted value for --ssl-fips-mode is 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.

    此选项已弃用。预计将在未来的 MySQL 版本中移除。This option is deprecated. Expect it to be removed in a future version of MySQL.

  • --tls-ciphersuites=ciphersuite_list

    命令行格式Command-Line Format --tls-ciphersuites=ciphersuite_list--tls-ciphersuites=ciphersuite_list
    类型Type 字符串String

    用于 TLSv1.3 加密连接的允许密码套件。该值是一个或多个用冒号分隔的密码套件名称的列表。此选项可指定的密码套件取决于用于编译 MySQL 的 SSL 库。有关详细信息,请参见 第 8.3.2 节,“加密连接的 TLS 协议和密码”。The permissible ciphersuites for encrypted connections that use TLSv1.3. The value is a list of one or more colon-separated ciphersuite names. The ciphersuites that can be named for this option depend on the SSL library used to compile MySQL. For details, see Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”.

  • --tls-sni-servername=server_name --tls-sni-servername=server_name

    命令行格式Command-Line Format --tls-sni-servername=server_name--tls-sni-servername=server_name
    类型Type 字符串String

    如果指定了名称,该名称将通过 mysql_options() 的 MYSQL_OPT_TLS_SNI_SERVERNAME 选项传递给 libmysqlclient C API 库。服务器名称不区分大小写。要显示客户端为当前会话指定的服务器名称(如果有),请检查 Tls_sni_server_name 状态变量。When specified, the name is passed to the libmysqlclient C API library using the MYSQL_OPT_TLS_SNI_SERVERNAME option of mysql_options(). The server name is not case-sensitive. To show which server name the client specified for the current session, if any, check the Tls_sni_server_name status variable.

    服务器名称指示(SNI)是 TLS 协议的一个扩展(必须使用支持 TLS 扩展的 OpenSSL 编译此选项才能生效)。MySQL 对 SNI 的实现仅代表客户端。Server Name Indication (SNI) is an extension to the TLS protocol (OpenSSL must be compiled using TLS extensions for this option to function). The MySQL implementation of SNI represents the client-side only.

  • --tls-version=protocol_list --tls-version=protocol_list

    命令行格式Command-Line Format --tls-version=protocol_list--tls-version=protocol_list
    类型Type 字符串String
    默认值Default Value

    TLSv1,TLSv1.1,TLSv1.2,TLSv1.3(OpenSSL 1.1.1 或更高版本)TLSv1,TLSv1.1,TLSv1.2,TLSv1.3 (OpenSSL 1.1.1 or higher)

    TLSv1,TLSv1.1,TLSv1.2(否则)TLSv1,TLSv1.1,TLSv1.2 (otherwise)

    用于加密连接的允许 TLS 协议。值是一个或多个以逗号分隔的协议名称列表。此选项可指定的协议取决于用于编译 MySQL 的 SSL 库。详情请参见 第 8.3.2 节,“加密连接 TLS 协议和密码”。The permissible TLS protocols for encrypted connections. The value is a list of one or more comma-separated protocol names. The protocols that can be named for this option depend on the SSL library used to compile MySQL. For details, see Section 8.3.2, “Encrypted Connection TLS Protocols and Ciphers”.

  • --user=user_name, -u user_name --user=user_name, -u user_name

    命令行格式Command-Line Format --user=user_name,--user=user_name,
    类型Type 字符串String

    用于连接服务器的 MySQL 帐户用户名。The user name of the MySQL account to use for connecting to the server.

    如果您正在使用 Rewriter 插件,请授予此用户 SKIP_QUERY_REWRITE 权限。If you are using the Rewriter plugin, grant this user the SKIP_QUERY_REWRITE privilege.

  • --verbose, -v

    命令行格式Command-Line Format --verbose--verbose

    详细模式。打印有关程序执行内容的更多信息。Verbose mode. Print more information about what the program does.

  • --version, -V

    命令行格式Command-Line Format --version

    显示版本信息并退出。Display version information and exit.

  • --vertical, -E

    命令行格式Command-Line Format --vertical

    以垂直方式打印输出。这类似于 --relative,但以垂直方式打印输出。Print output vertically. This is similar to --relative, but prints output vertically.

  • --wait[=count], -w[count]

    命令行格式Command-Line Format --wait

    如果无法建立连接,请等待并重试,而不是中止。如果给出了count值,它表示重试的次数。默认值为一次。If the connection cannot be established, wait and retry instead of aborting. If a count value is given, it indicates the number of times to retry. The default is one time.

  • --zstd-compression-level=level

    命令行格式Command-Line Format --zstd-compression-level=#
    类型Type 整数Integer

    用于与服务器连接时使用 zstd 压缩算法的压缩级别。允许的级别从 1 到 22,数值越大表示压缩级别越高。默认的 zstd 压缩级别为 3。对于不使用 zstd 压缩的连接,压缩级别设置没有效果。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. The default zstd compression level is 3. The compression level setting has no effect on connections that do not use zstd compression.

    更多信息,请参阅 第 6.2.8 节,“连接压缩控制”。For more information, see Section 6.2.8, “Connection Compression Control”.