On Unix and Unix-like systems, a process can be the recipient of
signals sent to it by the root system account
or the system account that owns the process. Signals can be sent
using the kill command. Some command
interpreters associate certain key sequences with signals, such as
Control+C to send a SIGINT
signal. This section describes how the MySQL server and client
programs respond to signals.
mysqld responds to signals as follows:
SIGTERMcauses the server to shut down. This is like executing aSHUTDOWNstatement without having to connect to the server (which for shutdown requires an account that has theSHUTDOWNprivilege).SIGHUPcauses the server to reload the grant tables and to flush tables, logs, the thread cache, and the host cache. These actions are like various forms of theFLUSHstatement. Sending the signal enables the flush operations to be performed without having to connect to the server, which requires a MySQL account that has privileges sufficient for those operations.This behavior is deprecated, and is subject to removal in a future version of MySQL.
SIGUSR1causes the server to flush the error log, general query log, and slow query log. One use forSIGUSR1is to implement log rotation without having to connect to the server, which requires a MySQL account that has privileges sufficient for those operations. For information about log rotation, see Section 7.4.6, “Server Log Maintenance”.The server response to
SIGUSR1is a subset of the response toSIGHUP, enablingSIGUSR1to be used as a more “lightweight” signal that flushes certain logs without the otherSIGHUPeffects such as flushing the thread and host caches and writing a status report to the error log.SIGINTnormally is ignored by the server. Starting the server with the--gdboption installs an interrupt handler forSIGINTfor debugging purposes. See Section 7.9.1.4, “Debugging mysqld under gdb”.
MySQL client programs respond to signals as follows:
The mysql client interprets
SIGINT(typically the result of typing Control+C) as instruction to interrupt the current statement if there is one, or to cancel any partial input line otherwise. This behavior can be disabled using the--sigint-ignoreoption to ignoreSIGINTsignals.Client programs that use the MySQL client library block
SIGPIPEsignals by default. These variations are possible:Client can install their own
SIGPIPEhandler to override the default behavior. See Writing C API Threaded Client Programs.Clients can prevent installation of
SIGPIPEhandlers by specifying theCLIENT_IGNORE_SIGPIPEoption tomysql_real_connect()at connect time. See mysql_real_connect().