首页 > 代码库 > MySQL 网络访问连接

MySQL 网络访问连接

分主机查看连接数

mysql> select count(1) 连接数,host_db.host 客户端 from ( select substring_index(host,:,1) as "host" from processlist ) host_db group by host_db.host;
+------+---------------+
| 连接数 | 客户端          |
+------+---------------+
|    3 | 172.16.91.237 |
|    3 | 172.16.91.249 |
|  186 | bogon         |
|   12 | localhost     |
+------+---------------+
4 rows in set

分数据库查看连接数

mysql> select count(1) 连接数,db 数据库 from processlist group by db;
+------+--------------------+
| 连接数 | 数据库               |
+------+--------------------+
|    1 | NULL               |
|    3 | bpm                |
|    3 | bpm_ys             |
|    3 | epm                |
|    2 | information_schema |
|  119 | perform2           |
|    5 | pms                |
|   39 | portal             |
|   29 | security_ys        |
+------+--------------------+
9 rows in set

 

MySQL 网络访问连接