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

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

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

Invoke mysqlshow like this:调用mysqlshow如下:

mysqlshow [options] [db_name [tbl_name [col_name]]]

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

If the last argument contains shell or SQL wildcard characters (*, ?, %, or _), only those names that are matched by the wildcard are shown. 如果最后一个参数包含shell或SQL通配符(*?%_),则只显示与通配符匹配的名称。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. 如果数据库名称包含任何下划线,则应使用反斜杠转义这些下划线(某些Unix shell需要两个),以获得正确表或列的列表。* and ? characters are converted into SQL % and _ wildcard characters. *?字符转换为SQL%_通配符。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. 当您尝试显示名称中带有_的表的列时,这可能会导致一些混淆,因为在这种情况下,mysqlshow只会显示与模式匹配的表名。This is easily fixed by adding an extra % last on the command line as a separate argument.通过在命令行上添加额外的%last作为单独的参数,可以很容易地解决这个问题。

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

Table 4.17 mysqlshow Options选项

Option Name选项名称Description描述Introduced引入版本Deprecated弃用版本
--bind-addressUse specified network interface to connect to MySQL Server使用指定的网络接口连接MySQL服务器
--compressCompress all information sent between client and server压缩客户端和服务器之间发送的所有信息8.0.18
--compression-algorithmsPermitted compression algorithms for connections to server服务器连接的允许压缩算法8.0.18
--countShow the number of rows per table显示每个表的行数
--debugWrite debugging log写入调试日志
--debug-checkPrint debugging information when program exits程序退出时打印调试信息
--debug-infoPrint debugging information, memory, and CPU statistics when program exits程序退出时打印调试信息、内存和CPU统计信息
--default-authAuthentication plugin to use要使用的身份验证插件
--default-character-setSpecify default character set指定默认字符集
--defaults-extra-fileRead named option file in addition to usual option files除了常规选项文件外,还读取命名选项文件
--defaults-fileRead only named option file只读命名选项文件
--defaults-group-suffixOption group suffix value选项组后缀值
--enable-cleartext-pluginEnable cleartext authentication plugin启用明文身份验证插件
--get-server-public-keyRequest RSA public key from server从服务器请求RSA公钥
--helpDisplay help message and exit显示帮助消息并退出
--hostHost on which MySQL server is locatedMySQL服务器所在的主机
--keysShow table indexes显示表索引
--login-pathRead login path options from .mylogin.cnf.mylogin.cnf读取登录路径选项
--no-defaultsRead no option files不读取选项文件
--passwordPassword to use when connecting to server连接到服务器时使用的密码
--pipeConnect to server using named pipe (Windows only)使用命名管道连接到服务器(仅限Windows)
--plugin-dirDirectory where plugins are installed安装插件的目录
--portTCP/IP port number for connection用于连接的TCP/IP端口号
--print-defaultsPrint default options打印默认选项
--protocolTransport protocol to use要使用的传输协议
--server-public-key-pathPath name to file containing RSA public key包含RSA公钥的文件的路径名
--shared-memory-base-nameShared-memory name for shared-memory connections (Windows only)共享内存连接的共享内存名称(仅限Windows)
--show-table-typeShow a column indicating the table type显示指示表类型的列
--socketUnix socket file or Windows named pipe to use要使用的Unix套接字文件或Windows命名管道
--ssl-caFile that contains list of trusted SSL Certificate Authorities包含受信任SSL证书颁发机构列表的文件
--ssl-capathDirectory that contains trusted SSL Certificate Authority certificate files包含受信任的SSL证书颁发机构证书文件的目录
--ssl-certFile that contains X.509 certificate包含X.509证书的文件
--ssl-cipherPermissible ciphers for connection encryption连接加密的允许密码
--ssl-crlFile that contains certificate revocation lists包含证书吊销列表的文件
--ssl-crlpathDirectory that contains certificate revocation-list files包含证书吊销列表文件的目录
--ssl-fips-modeWhether to enable FIPS mode on client side是否在客户端启用FIPS模式
--ssl-keyFile that contains X.509 key包含X.509密钥的文件
--ssl-modeDesired security state of connection to server与服务器连接的所需安全状态
--statusDisplay extra information about each table显示每个表的额外信息
--tls-ciphersuitesPermissible TLSv1.3 ciphersuites for encrypted connections加密连接允许的TLSv1.3密码套件8.0.16
--tls-versionPermissible TLS protocols for encrypted connections加密连接的允许TLS协议
--userMySQL user name to use when connecting to server连接到服务器时使用的MySQL用户名
--verboseVerbose mode详细模式
--versionDisplay version information and exit显示版本信息并退出
--zstd-compression-levelCompression level for connections to server that use zstd compression使用zstd压缩的服务器连接的压缩级别8.0.18