information_schema模式表介绍 processlist

在mysql里,我们一般通过show (full)processlist查看当前连接情况,处理各种数据库问题。现在在information_schema模式下,5.5以后增加了processlist表,里面存储了当前连接信息,跟show (full) processlist存储的一样。通过processlist 我们可以统计分析一些信息,而不依赖于shell命令(如 grep、awk等)

如 查询当前ip的连接信息

  mysql> select  substring_index(host,':',1),count(*)  from processlist 
  group by substring_index(host,':',1);