1. 相关查询连接数的命令
mysql>show variables like ‘%max_connections%‘;
+-------------------------+-----------------+
| Variable_name | Value |
+-------------------------+-----------------+
| extra_max_connections | |
| max_connections | 572 |
+-------------------------+-----------------+
返回行数:[2],耗时:3 ms.
mysql>select SUBSTRING_INDEX(host,‘:‘,1) as ip , count(*) from information_schema.processlist group by ip;
+----------------+--------------------+
| ip | count(*) |
+----------------+--------------------+
| 10.172.172.252 | 3 |
| 10.24.190.26 | 2 |
| 10.252.40.152 | 1 |
| 10.44.33.0 | 2 |
| 11.192.101.60 | 4 |
| 113.47.233.165 | 4 |
+----------------+--------------------+
返回行数:[6],耗时:2 ms.
mysql>show full processlist;
+--------------+-----------------+----------------------+-----------------+-------------------+----------------+-----------------+-----------------------+-----------------------+--------------------------------+------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------+-------------------------------+
| Id | User | Host | db | Command | Time | State | Info | Memory_used | Memory_used_by_query | Logical_read | Physical_sync_read | Physical_async_read | Temp_user_table_size | Temp_sort_table_size | Temp_sort_file_size |
+--------------+-----------------+----------------------+-----------------+-------------------+----------------+-----------------+-----------------------+-----------------------+--------------------------------+------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------+-------------------------------+
| 151531737 | chgg_dev | 10.252.40.152:34428 | chgg_erp_dev | Sleep | 3 | | | 0 | 8208 | 57 | 2 | 0 | 0 | 0 | 0 |
| 151620590 | chgg_erp_prod | 11.192.101.60:39350 | chgg_erp_prod | Sleep | 41 | | | 0 | 8208 | 0 | 0 | 0 | 0 | 0 | 0 |
| 168356902 | chgg_plant_prod | 10.24.190.26:33829 | chgg_plant_prod | Sleep | 4 | | | 0 | 8208 | 422 | 20 | 0 | 0 | 0 | 0 |
| 168474692 | chgg_plant_prod | 113.47.233.165:39228 | chgg_plant_prod | Sleep | 301 | | | 0 | 8208 | 145692 | 3566 | 580 | 0 | 0 | 0 |
| 168755874 | chgg_pmonitor | 10.172.172.252:49211 | chgg-pmonitor | Sleep | 1 | | | 2204008 | 8208 | 48178 | 287 | 0 | 0 | 0 | 0 |
| 202170433 | chgg_plant_prod | 113.47.233.165:39235 | chgg_plant_prod | Sleep | 336 | | | 7512 | 8208 | 0 | 0 | 0 | 0 | 0 | 0 |
| 218187874 | chgg_plant_prod | 113.47.233.165:39240 | chgg_plant_prod | Sleep | 338 | | | 0 | 8208 | 11 | 5 | 0 | 0 | 0 | 0 |
| 218973130 | chgg_erp_prod | 11.192.101.60:39372 | chgg_erp_prod | Query | 0 | init | show full processlist | 0 | 8208 | 0 | 0 | 0 | 0 | 0 | 0 |
| 537180277 | chgg_plant_prod | 113.47.233.165:39244 | chgg_plant_prod | Sleep | 338 | | | 0 | 8208 | 0 | 0 | 0 | 0 | 0 | 0 |
| 537315291 | chgg_pmonitor | 10.172.172.252:49210 | chgg-pmonitor | Sleep | 1 | | | 2201064 | 8208 | 47574 | 244 | 0 | 0 | 0 | 0 |
| 537591682 | chgg_erp_prod | 11.192.101.60:39234 | chgg_erp_prod | Sleep | 6 | | | 2240 | 8208 | 0 | 0 | 0 | 0 | 0 | 0 |
| 570439957 | chgg_dev | 10.44.33.0:51664 | zentaopms | Sleep | 3 | | | 0 | 8208 | 45 | 0 | 0 | 0 | 0 | 0 |
| 571064761 | chgg_dev | 10.44.33.0:50805 | zentaopms | Sleep | 7 | | | 2141656 | 8208 | 2526 | 9 | 0 | 0 | 0 | 0 |
| 571127916 | chgg_pmonitor | 10.172.172.252:49213 | chgg-pmonitor | Sleep | 1 | | | 2074416 | 8208 | 48131 | 295 | 0 | 0 | 0 | 0 |
| 604379796 | chgg_plant_prod | 10.24.190.26:33830 | chgg_plant_prod | Sleep | 4 | | | 0 | 8208 | 35 | 0 | 0 | 0 | 0 | 0 |
| 604656879 | chgg_erp_prod | 11.192.101.60:39265 | chgg_erp_prod | Sleep | 49 | | | 208 | 8208 | 1189 | 70 | 0 | 0 | 0 | 0 |
+--------------+-----------------+----------------------+-----------------+-------------------+----------------+-----------------+-----------------------+-----------------------+--------------------------------+------------------------+------------------------------+-------------------------------+--------------------------------+--------------------------------+-------------------------------+
返回行数:[16],耗时:2 ms.
mysql>show processlist;
+--------------+-----------------+----------------------+-----------------+-------------------+----------------+-----------------+------------------+
| Id | User | Host | db | Command | Time | State | Info |
+--------------+-----------------+----------------------+-----------------+-------------------+----------------+-----------------+------------------+
| 151531737 | chgg_dev | 10.252.40.152:34428 | chgg_erp_dev | Sleep | 3 | | |
| 151620590 | chgg_erp_prod | 11.192.101.60:39350 | chgg_erp_prod | Sleep | 41 | | |
| 168356902 | chgg_plant_prod | 10.24.190.26:33829 | chgg_plant_prod | Sleep | 4 | | |
| 168474692 | chgg_plant_prod | 113.47.233.165:39228 | chgg_plant_prod | Sleep | 301 | | |
| 168755874 | chgg_pmonitor | 10.172.172.252:49211 | chgg-pmonitor | Sleep | 1 | | |
| 202170433 | chgg_plant_prod | 113.47.233.165:39235 | chgg_plant_prod | Sleep | 336 | | |
| 218187874 | chgg_plant_prod | 113.47.233.165:39240 | chgg_plant_prod | Sleep | 338 | | |
| 218973130 | chgg_erp_prod | 11.192.101.60:39372 | chgg_erp_prod | Query | 0 | init | show processlist |
| 537180277 | chgg_plant_prod | 113.47.233.165:39244 | chgg_plant_prod | Sleep | 338 | | |
| 537315291 | chgg_pmonitor | 10.172.172.252:49210 | chgg-pmonitor | Sleep | 1 | | |
| 537591682 | chgg_erp_prod | 11.192.101.60:39234 | chgg_erp_prod | Sleep | 6 | | |
| 570439957 | chgg_dev | 10.44.33.0:51664 | zentaopms | Sleep | 3 | | |
| 571064761 | chgg_dev | 10.44.33.0:50805 | zentaopms | Sleep | 7 | | |
| 571127916 | chgg_pmonitor | 10.172.172.252:49213 | chgg-pmonitor | Sleep | 1 | | |
| 604379796 | chgg_plant_prod | 10.24.190.26:33830 | chgg_plant_prod | Sleep | 4 | | |
| 604656879 | chgg_erp_prod | 11.192.101.60:39265 | chgg_erp_prod | Sleep | 49 | | |
+--------------+-----------------+----------------------+-----------------+-------------------+----------------+-----------------+------------------+
返回行数:[16],耗时:2 ms. 2. 修改my.ini/my.cnf配置文件的最大连接数相关配置(阿里云服务器无效,增加连接数需要花钱买)[mysqld]max_connections = 1000wait_timeout = 5 3.如何重启mysql(阿里云服务器无效,无法重启mysql)service mysqld restart/etc/inint.d/mysqld restart
原文地址:https://www.cnblogs.com/liuzhiqaingxyz/p/9517205.html
时间: 2024-11-04 23:31:30