目次MySQL查询客户端毗连情况查询MySQL当前所有毗连及状态[code]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)[/code]查询MySQL当前毗连IP、状态及毗连数目[code]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)[/code]查询MySQL当前毗连IP及其毗连数目[code]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)[/code]查询MySQL最大毗连数[code]mysql> show variables like 'max_connections'; +-----------------+-------+ | Variable_name | Value | +-----------------+-------+ | max_connections | 600 | +-----------------+-------+ 1 row in set (0.01 sec)[/code]查询MySQL当前毗连数[code]mysql> show status like 'max_used_connections'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | Max_used_connections | 17 | +----------------------+-------+ 1 row in set (0.00 sec)[/code]总结以上为个人履历,渴望能给各人一个参考,也渴望各人多多支持脚本之家。 来源:https://www.jb51.net/database/326108t2d.htm 免责声明:如果侵犯了您的权益,请联系站长,我们会及时删除侵权内容,谢谢合作! |
|手机版|小黑屋|梦想之都-俊月星空
( 粤ICP备18056059号 )|网站地图
GMT+8, 2025-7-1 22:00 , Processed in 0.031146 second(s), 18 queries .
Powered by Mxzdjyxk! X3.5
© 2001-2025 Discuz! Team.