4.5.2 mysqladmin — A MySQL Server Administration ProgramMySQL服务器管理程序

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

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

mysqladmin supports the following commands. Some of the commands take an argument following the command name.mysqladmin支持以下命令。有些命令在命令名后有一个参数。

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

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

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

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.如果在使用Unix套接字文件连接到本地服务器时执行mysqladmin shutdownmysqladmin会等待直到服务器的进程ID文件被删除,以确保服务器已正确停止。

mysqladmin supports the following options, which can be specified on the command line or in the [mysqladmin] and [client] groups of an option file. mysqladmin支持以下选项,可以在命令行或选项文件的[mysqladmin][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.12 mysqladmin 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
--connect-timeoutNumber of seconds before connection timeout连接超时前的秒数
--countNumber of iterations to make for repeated command execution重复执行命令的迭代次数
--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启用明文身份验证插件
--forceContinue even if an SQL error occurs即使发生SQL错误,也要继续
--get-server-public-keyRequest RSA public key from server从服务器请求RSA公钥
--helpDisplay help message and exit显示帮助消息并退出
--hostHost on which MySQL server is locatedMySQL服务器所在的主机
--login-pathRead login path options from .mylogin.cnf从.mylogin.cnf读取登录路径选项
--no-beepDo not beep when errors occur发生错误时不要发出蜂鸣声
--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要使用的传输协议
--relativeShow the difference between the current and previous values when used with the --sleep option与--sleep选项一起使用时,显示当前值和以前值之间的差异
--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-warningsShow warnings after statement execution执行语句后显示警告
--shutdown-timeoutThe maximum number of seconds to wait for server shutdown等待服务器关闭的最大秒数
--silentSilent mode静音模式
--sleepExecute commands repeatedly, sleeping for delay seconds in between重复执行命令,在两者之间休眠几秒钟
--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与服务器连接的所需安全状态
--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显示版本信息并退出
--verticalPrint query output rows vertically (one line per column value)垂直打印查询输出行(每列值一行)
--waitIf the connection cannot be established, wait and retry instead of aborting如果无法建立连接,请等待并重试,而不是中止
--zstd-compression-levelCompression level for connections to server that use zstd compression使用zstd压缩的服务器连接的压缩级别8.0.18