Mysql Tricks : Find out who is doing what, and kill the process if needed.

Find out who is doing what, and kill the process if needed.
    This example kills Id 657.

    mysql> show processlist;
    show processlist;
    +-----+------+-----------+---------+---------+-------+-------+------------------+
    | Id  | User | Host      | db      | Command | Time  | State | Info             |
    +-----+------+-----------+---------+---------+-------+-------+------------------+
    | 657 | prog | localhost | weather | Sleep   | 28619 |       | NULL             |
    | 782 | prog | localhost | weather | Sleep   |   853 |       | NULL             |
    | 785 | prog | localhost | NULL    | Query   |     0 | NULL  | show processlist |
    +-----+------+-----------+---------+---------+-------+-------+------------------+
    3 rows in set (0.00 sec)

    mysql>kill 657

    Or, from the command line, to kill process 782

    [root@third-fl-71 mysql]# mysqladmin processlist
    +-----+------+-----------+---------+---------+------+-------+------------------+
    | Id  | User | Host      | db      | Command | Time | State | Info             |
    +-----+------+-----------+---------+---------+------+-------+------------------+
    | 782 | prog | localhost | weather | Sleep   | 2676 |       |                  |
    | 785 | prog | localhost |         | Sleep   | 1823 |       |                  |
    | 793 | root | localhost |         | Query   | 0    |       | show processlist |
    +-----+------+-----------+---------+---------+------+-------+------------------+
    [root@third-fl-71 mysql]#

    [root@third-fl-71 mysql]# mysqladmin kill 782

    Note, the following can also be helpful

    mysql> show status;
        or
    mysql> show status\G
        also
    mysql> show innodb status;
        or
    mysql> show table status like '%';

        The above gives you create time and other information.

You can follow any responses to this entry through the RSS 2.0 feed. You can leave a response, or trackback from your own site.

AddThis Social Bookmark Button

Leave a Reply

*
To prove that you're not a bot, enter this code
Anti-Spam Image