8.4 中文镜像

MySQL 8.4 参考手册 · 中文镜像

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

打开官方英文原文 ↗

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

MySQL 8.4 参考手册 / 6 个 MySQL 程序 / 6.5 客户端程序 / 6.5.6 mysqlshow — 显示数据库、表和列信息
中文点击中文段落可显示 / 隐藏英文原文本页译文覆盖 87%

6.5.6 mysqlshow — 显示数据库、表和列信息6.5.6 mysqlshow — Display Database, Table, and Column Information

mysqlshow 客户端可用于快速查看数据库、其表,或某个表的列或索引。The mysqlshow client can be used to quickly see which databases exist, their tables, or a table's columns or indexes.

mysqlshow 提供了一个命令行接口,用于执行多个 SQL SHOW 语句。请参见 第 15.7.7 节,“SHOW 语句”。相同的信息也可以通过直接使用这些语句来获取。例如,您可以从 mysql 客户端程序发出这些语句。mysqlshow provides a command-line interface to several SQL SHOW statements. See Section 15.7.7, “SHOW Statements”. The same information can be obtained by using those statements directly. For example, you can issue them from the mysql client program.

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

mysqlshow [options] [db_name [tbl_name [col_name]]]
  • 如果未指定数据库,则显示数据库名称列表。If no database is given, a list of database names is shown.

  • 如果未指定表,则显示数据库中所有匹配的表。If no table is given, all matching tables in the database are shown.

  • 如果未指定列,则显示表中所有匹配的列及列类型。If no column is given, all matching columns and column types in the table are shown.

输出仅显示您拥有某些权限的数据库、表或列的名称。The output displays only the names of those databases, tables, or columns for which you have some privileges.

如果最后一个参数包含 shell 或 SQL 通配符字符(*、?、% 或 _),则只显示与通配符匹配的名称。如果数据库名称包含下划线,则应该使用反斜杠进行转义(某些 Unix shell 需要两个)以获取正确的表或列列表。* 和 ? 字符将被转换为 SQL 的 % 和 _ 通配符字符。当你尝试显示表名中包含 _ 的表的列时,这可能会导致一些混淆,因为在这种情况下,mysqlshow 只显示与模式匹配的表名。这个问题很容易通过在命令行的最后以单独参数的形式添加一个额外的 % 来解决。If the last argument contains shell or SQL wildcard characters (*, ?, %, or _), only those names that are matched by the wildcard are shown. If a database name contains any underscores, those should be escaped with a backslash (some Unix shells require two) to get a list of the proper tables or columns. * and ? characters are converted into SQL % and _ wildcard characters. This might cause some confusion when you try to display the columns for a table with a _ in the name, because in this case, mysqlshow shows you only the table names that match the pattern. This is easily fixed by adding an extra % last on the command line as a separate argument.

mysqlshow 支持以下选项,这些选项可以在命令行中指定,也可以在选项文件的 [mysqlshow] 和 [client] 组中指定。有关 MySQL 程序使用的选项文件的信息,请参阅 第 6.2.2.2 节,“使用选项文件”。mysqlshow supports the following options, which can be specified on the command line or in the [mysqlshow] 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.15 mysqlshow 选项Table 6.15 mysqlshow 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
--计数--count 显示每个表的行数Show the number of rows per table
--调试--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 除了常规选项文件外,读取指定名称的选项文件Read named option file in addition to usual option files
--默认文件--defaults-file 仅读取指定的选项文件Read only named option file
--默认组后缀--defaults-group-suffix 选项组后缀值Option group suffix value
--启用明文插件--enable-cleartext-plugin 启用明文身份验证插件Enable cleartext authentication plugin
--获取服务器公钥--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
--键--keys 显示表索引Show table indexes
--登录路径--login-path 从 .mylogin.cnf 读取登录路径选项Read login path options from .mylogin.cnf
--不使用默认设置--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
--服务器公钥路径--server-public-key-path 包含 RSA 公钥的文件路径名称Path name to file containing RSA public key
--共享内存基名--shared-memory-base-name 共享内存连接的共享内存名称(仅限 Windows)Shared-memory name for shared-memory connections (Windows only)
--显示表类型--show-table-type 显示一个指示表格类型的列Show a column indicating the table type
--套接字--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
--状态--status 显示每个表的额外信息Display extra information about each table
--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
--zstd-压缩等级--zstd-compression-level 用于与服务器进行 zstd 压缩连接的压缩级别Compression level for connections to server that use zstd compression

  • --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”.

  • --count

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

    显示每个表的行数。对于非MyISAM表,这可能比较慢。Show the number of rows per table. This can be slow for non-MyISAM tables.

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

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

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

    此选项仅在 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-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”.

  • --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”.

  • --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

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

    不仅要读取常规的选项组,还要读取带有常规名称并附加str后缀的组。例如,mysqlshow 通常读取[client] 和 [mysqlshow] 组。如果此选项以 --defaults-group-suffix=_other 的形式给出,mysqlshow 还会读取 [client_other] 和 [mysqlshow_other] 组。Read not only the usual option groups, but also groups with the usual names and a suffix of str. For example, mysqlshow normally reads the [client] and [mysqlshow] groups. If this option is given as --defaults-group-suffix=_other, mysqlshow also reads the [client_other] and [mysqlshow_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”.)

  • --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 RSA public key that it uses for key pair-based password exchange. This option applies to clients that connect to the server using an account that authenticates with the caching_sha2_password authentication plugin. For connections by such accounts, the server does not send the public key to the client unless requested. The option is ignored for accounts that do not authenticate with that plugin. It is also ignored if RSA-based password exchange is not needed, 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.

  • --keys, -k

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

    显示表索引。Show table indexes.

  • --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-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

    The password of the MySQL account used for connecting to the server. The password value is optional. If not given, mysqlshow prompts for one. If given, there must be 不能有空格。如果未指定密码选项,默认是不发送密码。--password=或者-p以用户名称The password of the MySQL account used for connecting to the server. The password value is optional. If not given, mysqlshow 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”.

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

  • --password1[=pass_val]

    用于连接服务器的 MySQL 账户的多因素认证第 1 因子的密码。密码值是可选的。如果未提供,mysqlshow 会提示输入密码。如果提供,--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, mysqlshow 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”.

    要明确指定没有密码,并且 mysqlshow 不应提示输入密码,请使用 --skip-password1 选项。To explicitly specify that there is no password and that mysqlshow 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 选项来指定认证插件,但 mysqlshow 无法找到它,则指定此选项。请参阅 第 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 mysqlshow 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

    命令行格式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}

    命令行格式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”.

  • --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-table-type, -t

    命令行格式Command-Line Format --show-table-type

    显示指示表类型的列,如 SHOW FULL TABLES 中所示。类型为 BASE TABLE 或 VIEW。Show a column indicating the table type, as in SHOW FULL TABLES. The type is BASE TABLE or VIEW.

  • --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.

  • --status, -i --status, -i

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

    显示每个表的额外信息。Display extra information about each table.

  • --tls-ciphersuites=ciphersuite_list --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.

  • --verbose, -v --verbose, -v

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

    详细模式。打印有关程序执行内容的更多信息。此选项可以多次使用以增加信息量。Verbose mode. Print more information about what the program does. This option can be used multiple times to increase the amount of information.

  • --version, -V --version, -V

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

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

  • --zstd-compression-level=level --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”.