zoukankan      html  css  js  c++  java
  • mysql shutdown and kill

    --mysqladmin shutdown

    If you execute mysqladmin shutdown when connecting to a local server using a Unix socket file, mysqladminwaits until the server's process ID file has been removed, to ensure that the server has stopped properly.

     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.

    KILL permits an optional CONNECTION or QUERY modifier:

    • KILL CONNECTION is the same as KILL with no modifier: It terminates the connection associated with the giventhread_id.

    • KILL QUERY terminates the statement that the connection is currently executing, but leaves the connection itself 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.

    Note

    You 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 any connection threads of its own.

    When you use 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 SELECTORDER 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 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 are not using transactions, the changes are not rolled back.

    • GET_LOCK() aborts and returns NULL.

    • An INSERT DELAYED thread quickly flushes (inserts) all rows it has 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 is aborted with a disk full” error message.

    • Warning

      Killing a REPAIR TABLE or OPTIMIZE TABLE operation on a MyISAM table results in a table that is corrupted and unusable. Any reads or writes to such a table fail until you optimize or repair it again (without interruption).

  • 相关阅读:
    在线预览Office文档
    花生壳内网穿透
    Net core跨域
    EF链表查询
    Python冒泡排序、选择排序、插入排序、希尔排序、归并排序
    竟然可以这样学python!
    如何使用python打印9乘9乘法口诀表?
    python爬取小视频
    —用python写PDF转换器
    从0到1搭建个人博客-Django(三)
  • 原文地址:https://www.cnblogs.com/jackhub/p/3798878.html
Copyright © 2011-2022 走看看