MySQL view all connected client ips

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.

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=325721092&siteId=291194637