mysql客户端一个sql执行未完全取消,(用的是guI工具)
(之后又加上某个字段是ip 10.23.23.23的索引 现在这个巨大的操作仍然在执行(130万记录) )
在服务器linux上 用 top命令看不到这个session
我现在需要找到这个session的 进程id,之后kill掉。如何找到这个session的 进程id

解决方案 »

  1.   

    用 show processlist;
    和 kill xx;mysql> show processlist;
    +----+------+----------------+------+---------+------+-------+------------------+
    | Id | User | Host           | db   | Command | Time | State | Info|
    +----+------+----------------+------+---------+------+-------+------------------+
    |  1 | root | localhost:1288 | test | Query   |    0 | NULL  | show processlist|
    |  2 | root | localhost:3456 | test | Sleep   |    9 |       | NULL|
    +----+------+----------------+------+---------+------+-------+------------------+
    2 rows in set (0.00 sec)mysql> kill 2;
    Query OK, 0 rows affected (0.00 sec)mysql> show processlist;
    +----+------+----------------+------+---------+------+-------+------------------+
    | Id | User | Host           | db   | Command | Time | State | Info|
    +----+------+----------------+------+---------+------+-------+------------------+
    |  1 | root | localhost:1288 | test | Query   |    0 | NULL  | show processlist|
    +----+------+----------------+------+---------+------+-------+------------------+
    1 row in set (0.00 sec)mysql>
      

  2.   

    如果你的MYSQL5以上,可以查找
    information_schema.`PROCESSLIST`表,得到coonect id,再KILL
      

  3.   

    感觉楼上2为朋友。解决问题。
    描述情况: (2台机器 复制环境)
    主机
    3个
    1   alter index
    2       select
    3   sleep    ????
    很奇怪 我kill掉2,3  , 第1个alter index马上就好了从机
    1         alter index
    2         select
    3   sleep
    一样 的 kill掉2,3  , 第1个alter index马上就好了。解决哦这个问题 ,很开心。
    有疑问:
    a   3   sleep    ????         这个没有select语句, 不知道这个进程是干什么的 
    b   看来那个select进程还是产生表结构的锁,导致不能加上索引。?(原因基本找到)select大表 mysql的能力感觉好弱   (我以前在oracle下 执行5千万的大表 ,是很快的)
    直觉达标性能mysql不是很好的 
     
      

  4.   

    select distinct a.id,a.name,a.birthdate 
    from a t1, a t2 ,c ,d 
    where t1.lastaccess <='2009-06-01'  and t1.lastaccess>='2009-05-01' and 
    t2.lastaccess <='2009-06-01'  and t2.lastaccess>='2009-05-01' and trim(ifnull(t1.ip,'')) <>''    
        and trim(ifnull(t2.ip,'')) <>'' 
        and t1.ip=t2.ip 
    and t1.id != t2.id 
    and t1.id=c.id 
    and t1.id=d.id 
    order by a.birthdate 
    order by t1.lastaccess desc limit 0,5 最后改成还是不出数据 
      

  5.   

    Sleep The thread is waiting for the client to send a new statement to it. 
    线程(即用户连接)正在等用户的新命令输入。
      

  6.   

    SHOW PROCESSLIST
    displays "copy to tmp table" message.
      

  7.   

    大表不用distinct 这种函数 ,换用group by