mysql数据库查看连接数、并发数相关信息

原文链接:https://blog.csdn.net/eddy23513/article/details/80022725

  1. 查看连接数
show status like 'Threads%';

+-------------------+-------+
| Variable_name     | Value |
+-------------------+-------+
| Threads_cached    | 58    |
| Threads_connected | 57    |   ###这个数值指的是打开的连接数
| Threads_created   | 3676  |
| Threads_running   | 4     |   ###这个数值指的是激活的连接数,这个数值一般远低于connected数值
+-------------------+-------+
Threads_connected 跟show processlist结果相同,表示当前连接数。准确的来说,Threads_running是代表当前并发数

  1. 查询数据库当前设置的最大连接数
show variables like '%max_connections%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 1000  |
+-----------------+-------+
————————————————

  1. 查询连接有关的参数
show variables like '%connect%';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| character_set_connection | utf8|
| collation_connection     | utf8_general_ci|
| connect_timeout          | 10|
| disconnect_on_expired_password| ON|
| init_connect|            |
| max_connect_errors       | 100|
| max_connections          | 400|
| max_user_connections     | |
| performance_schema_session_connect_attrs_size| 512|
+-----------------+-------+

  1. 查看当前连接的进程信息
show processlist;	
  1. 设置最大连接数
set GLOBAL max_connections=400;

或:
修改mysql配置文件my.cnf,在[mysqld]段中添加或修改max_connections值;
  • 0
    点赞
  • 3
    收藏
    觉得还不错? 一键收藏
  • 打赏
    打赏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包

打赏作者

香辣奥利奥

你的鼓励将是我创作的最大动力

¥1 ¥2 ¥4 ¥6 ¥10 ¥20
扫码支付:¥1
获取中
扫码支付

您的余额不足,请更换扫码支付或充值

打赏作者

实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值