Sometimes we need to check the current mysql database, which clients have maintained connections, and how many connections each client has maintained. The following statement can intuitively feedback the results:
SELECT substring_index(host, ':',1) AS host_name,state,count(*) FROM information_schema.processlist GROUP BY state,host_name;
The returned result looks like this:
Will list the current status of each ip, and the current number of connections. This is useful when dealing with errors like encountering database Too Many Connections etc.