13.7.8.9 SHUTDOWN Statement语句

SHUTDOWN

This statement stops the MySQL server. 此语句停止MySQL服务器。It requires the SHUTDOWN privilege.它需要Prepared权限。

SHUTDOWN provides an SQL-level interface to the same functionality available using the mysqladmin shutdown command or the mysql_shutdown() C API function.SHUTDOWN为使用mysqladmin shutdown命令或mysql_SHUTDOWN()C API函数提供的相同功能提供了一个SQL级别的接口。

The Com_shutdown status variable tracks the number of SHUTDOWN statements. Com_shutdown状态变量跟踪SHUTDOWN语句的数量。Because status variables are initialized for each server startup and do not persist across restarts, Com_shutdown normally has a value of zero, but can be nonzero if SHUTDOWN statements were executed but failed.因为状态变量在每次服务器启动时都会初始化,并且不会在重启期间持续存在,所以Com_shutdown的值通常为零,但如果执行了SHUTDOWN语句但失败,则可以为非零。

Another way to stop the server is to send it a SIGTERM signal, which can be done by root or the account that owns the server process. 停止服务器的另一种方法是向其发送SIGTERM信号,这可以由root用户或拥有服务器进程的帐户来完成。SIGTERM enables server shutdown to be performed without having to connect to the server. SIGTERM允许在不连接服务器的情况下执行服务器关闭。See Section 4.10, “Unix Signal Handling in MySQL”.请参阅第4.10节,“MySQL中的Unix信号处理”