--mysqladmin shutdown
If you execute mysqladmin shutdown while connecting to a local server using a Unix socket file, mysqladminwaits until the server's process ID file has a been removed, to ensure that the server has stopped properly.
KILL
Syntax
thread_id
Each connection to Mysqld runs in a separate thread. You can see which threads is running with the SHOW PROCESSLIST
statement and kill a thread with the KILL thread_id
statement.
KILL
Permits an optional CONNECTION
or QUERY
modifier:
KILL CONNECTION
Is the same as with KILL
no modifier:it terminates the connection associated with the given thread_id
.
KILL QUERY
Terminates the statement, the connection is currently executing, but leaves the connection itself intact.
If you had PROCESS
the privilege, you can see all threads. If you had SUPER
the privilege, you can kill all threads and statements. Otherwise, you can see and kill only your own threads and statements.
You can also with the mysqladmin processlist and mysqladmin kill commands to examine and kill threads.
Note
You cannot use with the KILL
Embedded MySQL Server Library because the Embedded Server merely runs the inside of The host application. It does not create any connection threads of its own.
When you use KILL
, a thread-specific kill flag was set for the thread. In most cases, it might take some time for the thread of the die because the kill flag was checked only at specific intervals:
In SELECT
, ORDER BY
and GROUP BY
loops, the flag was checked after reading a block of rows. If the KILL flag is set, the statement is aborted.
During ALTER TABLE
, the kill flag is checked before each block of rows was read from the original table. If the KILL flag was set, the statement are aborted and the temporary table is deleted.
During UPDATE
or DELETE
operations, the kill flag is checked after each block read and after each updated or deleted row. If the KILL flag is set, the statement is aborted. Note that if you is not using transactions, the changes is not rolled back.
GET_LOCK()
Aborts and returns NULL
.
An INSERT DELAYED
thread quickly flushes (inserts) All rows it have in memory and then terminates.
If the thread is in the table lock handler (state: Locked
), the table lock is quickly aborted.
If the thread is waiting for free disk space in a write call, the write was aborted with a "disk full" error MESSAG E.
- Warning
Killing a REPAIR TABLE
or OPTIMIZE TABLE
operation on a MyISAM
table results in a table it is corrupted and unusable. Any reads or writes to such a table fail until you optimize or repair it again (without interruption).