show processlist 检查数据库被访问状况

show processlist 检查数据库被访问状况

mysql> show processlist;

+--------+------+----------------------+-----------+---------+-------+-------+--------+

Id | User | Host | db | Command | Time | State | Info |

+--------+------+----------------------+-----------+---------+-------+-------+--------+

318150 | root | 62.195.198.135:2344 | 5184top | Sleep | 120 | | NULL |

318159 | root | 62.195.198.135:2369 | testshop | Sleep | 78 | | NULL |

318876 | root | 62.195.198.135:5398 | 5184CMS | Sleep | 78 | | NULL |

+--------+------+----------------------+-----------+---------+-------+-------+--------+

id #ID标识,要kill一个语句的时候很有用

use #当前连接用户

host #显示这个连接从哪个ip的哪个端口上发出

db #数据库名

command #连接状态,一般是休眠(sleep),查询(query),连接(connect)

time #连接持续时间,单位是秒

state #显示当前sql语句的状态

info #显示这个sql语句