mysql> SELECT host, state FROM information_schema.processlist; +----------------------+-----------+ | host | state | +----------------------+-----------+ | localhost | executing | | 183.192.226.255:1842 | | | 183.192.226.255:1841 | | +----------------------+-----------+ 3 rows in set (0.00 sec)
mysql> SELECT substring_index(host, ':', 1) AS ip, state, count(*) FROM information_schema.processlist GROUP BY ip, state; +-----------------+-----------+----------+ | ip | state | count(*) | +-----------------+-----------+----------+ | 183.192.226.255 | | 2 | | localhost | executing | 1 | +-----------------+-----------+----------+ 2 rows in set (0.00 sec)
mysql> SELECT substring_index(host, ':', 1) AS ip, count(*) FROM information_schema.processlist GROUP BY ip; +-----------------+----------+ | ip | count(*) | +-----------------+----------+ | 183.192.226.255 | 2 | | localhost | 1 | +-----------------+----------+ 2 rows in set (0.01 sec)
mysql> show variables like 'max_connections'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 600 | +-----------------+-------+ 1 row in set (0.01 sec)
mysql> show status like 'max_used_connections'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | Max_used_connections | 17 | +----------------------+-------+ 1 row in set (0.00 sec)
以上为个人经验,希望对您有所帮助。