查询mysql连接数、并发数信息

1、查询数据库当前设置的最大连接数:

mysql> show variables like '%max_connections%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
1 row in set (0.00 sec)

修改mysql最大连接数:

临时修改: set global max_connections=1000 或

在数据库配置文件进行永久修改:

[mysqld]

max_connections = 1000

 

2、查看服务器响应的最大连接数:

mysql> show status like '%Max_used_connections%';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | 416 |
+----------------------+-------+
1 row in set (0.00 sec)

 

3、查看打开的连接数及并发数:

mysql> show status like 'Thread%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 14 |              
| Threads_connected | 203 |   #打开的文件数,跟show processlist结果相同
| Threads_created | 26930 |    #创建过的线程数
| Threads_running | 2 |            #激活的连接数,代表当前并发数
+-------------------+-------+
4 rows in set (0.00 sec)

 

 

posted @ 2017-09-21 10:09  helloworld899  阅读(290)  评论(0编辑  收藏  举报