赞
踩
Too many connections
原因及解决办法连接数超过了Mysql配置的最大连接数,所以拒绝新的连接
错误连接太多,而等待时间有过长。导致很多错误连接未关闭。
mysql> show variables like '%max_connections%';
+------------------------+-------+
| Variable_name | Value |
+------------------------+-------+
| max_connections | 151 |
| mysqlx_max_connections | 100 |
+------------------------+-------+
2 rows in set (0.01 sec)
SHOW PROCESSLIST; #查看前 100 条连接
SHOW full PROCESSLIST; #查看所有连接
mysql> show status like 'Threads%';
+-------------------+-------+
| Variable_name | Value |
+-------------------+-------+
| Threads_cached | 0 |
| Threads_connected | 114 |
| Threads_created | 286 |
| Threads_running | 2 |
+-------------------+-------+
4 rows in set (0.01 sec)
SET GLOBAL interactive_timeout = 60;
SET GLOBAL wait_timeout = 60;
/etc/mysql/mysql.conf.d/mysqld.cnf
,修改对应的参数[mysqld]
interactive_timeout=60
wait_timeout=60
set GLOBAL max_connections = 300;
/etc/mysql/mysql.conf.d/mysqld.cnf
。max_connections
的值tips:
临时变更配置的方法,在重启 MySQL 后会恢复配置文件中的设置值
可修改配置文件,重启MySQL
Copyright © 2003-2013 www.wpsshop.cn 版权所有,并保留所有权利。