max_connections 与 max_used_connections --ERROR 1040: Too many connections

时间:2023-03-10 02:40:00
max_connections 与 max_used_connections  --ERROR 1040: Too many connections
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | |
+-----------------+-------+
row in set (0.03 sec) mysql> show global status like 'max_used_connections';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | |
+----------------------+-------+
row in set (0.19 sec)

secureCRT在打开一个窗口 mysql -uroot -p 登陆
mysql> show global status like 'max_used_connections';
+----------------------+-------+
| Variable_name | Value |
+----------------------+-------+
| Max_used_connections | |
+----------------------+-------+
row in set (0.01 sec)

MySQL比较理想的最大连接数计算方式为:

1
max_used_connections / max_connections * 100% ≈ 85%