DOC HOME SITE MAP MAN PAGES GNU INFO SEARCH
 

(mysql.info.gz) KILL

Info Catalog (mysql.info.gz) FLUSH (mysql.info.gz) Other administrative SQL (mysql.info.gz) LOAD INDEX
 
 13.5.5.3 `KILL' Syntax
 ......................
 
      KILL [CONNECTION | QUERY] THREAD_ID
 
 Each connection to `mysqld' runs in a separate thread.  You can see
 which threads are running with the `SHOW PROCESSLIST' statement and kill
 a thread with the `KILL thread_id' statement.
 
 As of MySQL 5.0.0, `KILL' allows the optional `CONNECTION' or `QUERY'
 modifiers:
 
    * `KILL CONNECTION' is the same as `KILL' with no modifier: It
      terminates the connection associated with the given THREAD_ID.
 
    * `KILL QUERY' terminates the statement that the connection currently
      is executing, but leaves the connection intact.
 
 
 If you have the `PROCESS' privilege, you can see all threads.  If you
 have the `SUPER' privilege, you can kill all threads and statements.
 Otherwise, you can see and kill only your own threads and statements.
 
 You can also use the `mysqladmin processlist' and `mysqladmin kill'
 commands to examine and kill threads.
 
 * You currently cannot use `KILL' with the Embedded MySQL Server
 library, because the embedded server merely runs inside the threads of
 the host application, it does not create connection threads of its own.
 
 When you do a `KILL', a thread-specific kill flag is set for the thread.
 In most cases, it might take some time for the thread to die, because
 the kill flag is checked only at specific intervals:
 
    * In `SELECT', `ORDER BY' and `GROUP BY' loops, the flag is 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 are read from the original table. If the kill flag was set,
      the statement is aborted and the temporary table is deleted.
 
    * During `UPDATE' or `DELETE', 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 are not using
      transactions, the changes will not be rolled back!
 
    * `GET_LOCK()' will abort and return `NULL'.
 
    * An `INSERT DELAYED' thread will quickly flush (insert) all rows it
      has in memory and terminate.
 
    * If the thread is in the table lock handler (state: `Locked'), the
      table lock will be quickly aborted.
 
    * If the thread is waiting for free disk space in a write call, the
      write is aborted with a "disk full" error message.
 
    * Some threads might refuse to be killed.  For example, `REPAIR
      TABLE', `CHECK TABLE', and `OPTIMIZE TABLE' cannot be killed before
      MySQL 4.1 and run to completion.  This is changed: `REPAIR TABLE'
      and `OPTIMIZE TABLE' can be killed as of MySQL 4.1.0, as can
      `CHECK TABLE' as of MySQL 4.1.3.  However, killing a `REPAIR
      TABLE' or `OPTIMIZE TABLE' operation on a `MyISAM' table results
      in a table that IS corrupted and will be unusable (reads and
      writes to it will fail) until you optimize or repair it again.
 
Info Catalog (mysql.info.gz) FLUSH (mysql.info.gz) Other administrative SQL (mysql.info.gz) LOAD INDEX
automatically generated byinfo2html