直接执行show full processlist 即可

解决方案 »

  1.   

    show full processlist;即可
      

  2.   

    root用户已创建一个会话,使用SHOW FULL PROCESSLIST查看mysql> SHOW FULL PROCESSLIST;
    +----+------+-----------+-----------+---------+------+-------+-----------------------+
    | Id | User | Host      | db        | Command | Time | State | Info                  |
    +----+------+-----------+-----------+---------+------+-------+-----------------------+
    |  1 | root | localhost | employees | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |
    +----+------+-----------+-----------+---------+------+-------+-----------------------+
    1 row in set (0.38 sec)
    其中ID表示 connection id。再次创建会话[root@robin ~]# mysql -uroot -p
    Welcome to the MySQL monitor.  Commands end with ; or \g.
    Your MySQL connection id is 11
    Server version: 5.5.29-log Source distributionCopyright (c) 2000, 2012, Oracle and/or its affiliates. All rights reserved.Oracle is a registered trade of Oracle Corporation and/or its
    affiliates. Other names may be trades of their respective
    owners.Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
    再次查看SHOW FULL PROCESSLIST:mysql> SHOW FULL PROCESSLIST;
    +----+------+-----------+-----------+---------+------+-------+-----------------------+
    | Id | User | Host      | db        | Command | Time | State | Info                  |
    +----+------+-----------+-----------+---------+------+-------+-----------------------+
    |  1 | root | localhost | employees | Query   |    0 | NULL  | SHOW FULL PROCESSLIST |
    | 11 | root | localhost | NULL      | Sleep   |    7 |       | NULL                  |
    +----+------+-----------+-----------+---------+------+-------+-----------------------+
    2 rows in set (0.00 sec)
    现在变成两个ID,1和11.Understand?