首页 > 解决方案 > MySQL“连接”显示的数字太高 - 显示状态

问题描述

我们的网站每天访问量很大,数据库上有很多写入和读取。我们正在运行 InnoDB 和 Laravel,使用以下命令:

 show status like 'Conn%';

显示我们有199641163个连接,而且这个数字一直在增加,我只想知道这是否正常!?

标签: mysqlinnodb

解决方案


show status like 'Conn%'; This does not show active connections,it means the total number throughout history.

to check active connection you can use

SHOW STATUS WHERE `variable_name` = 'Max_used_connections';

or

show status where `variable_name` = 'Threads_connected';

In order to check the maximum allowed connections,

SHOW VARIABLES LIKE "max_connections";

推荐阅读