阿里云RDS报错:Too many connections
Posted
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了阿里云RDS报错:Too many connections相关的知识,希望对你有一定的参考价值。
在使用虚拟主机过程中,如果应用程序连接mysql的连接数过多,会导致网页程序报如下错误:
Can not connect to MySQL server
Error: Too many connections
此问题的原因是由于程序没有及时释放mysql数据库连接,连接数堆积、变满,导致新的连接无法连接到mysql。
1.查看数据库的最大连接数:
mysql>show variables like ‘%max_connections%‘;
+-------------------------+-----------------+
| Variable_name | Value
+-------------------------+-----------------+
| extra_max_connections | |
| max_connections | 110 |
+-------------------------+-----------------+
共返回 2 行记录,花费 121.61 ms.
2.查看连接数据库IP的连接数:
mysql>select SUBSTRING_INDEX(host,‘:‘,1) as ip , count(*) from information_schema.processlist group by ip;
+----------------+--------------------+
| ip | count(*) |
+----------------+--------------------+
| 110.110.10.110 | 1 |
| 110.110.10.111 | 3 |
| 110.110.10.112 | 2 |
| 110.110.10.113 | 1 |
| 110.110.10.114 | 2 |
| 110.110.10.115 | 10 |
| 110.110.10.116 | 2 |
+----------------+--------------------+
共返回 7 行记录,花费 69.87 ms.
3.查看当前数据库连接状态:
mysql>show full processlist;
4.kill掉ID持续时间很长的连接
mysql>kill 35007306;
以上是关于阿里云RDS报错:Too many connections的主要内容,如果未能解决你的问题,请参考以下文章
MySQL 数据库报错 Too many connections
mysql连接数太小,导致网站报错mysql:Too many connections
mysql数据库Too many connections报错排查
mysql数据库Too many connections报错排查
MySQL报错[Error] MySQL establishment of connection, message from server Too many connection
mysql 报错too many connections,修改max_connections连接数设置后不生效的解决方案