Error 1040: Too many connections
登录 mysql 查看 conn连接数配置
MySQL [(none)]> show variables like '%max_connections%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | extra_max_connections | 1 | | max_connections | 512 | +-----------------------+-------+ 2 rows in set (0.00 sec) MySQL [(none)]> show global status like 'Max_used_connections'; +----------------------+-------+ | Variable_name | Value | +----------------------+-------+ | Max_used_connections | 513 | +----------------------+-------+ 1 row in set (0.00 sec)
-
max_connections 是mysql最大连接数
-
Max_used_connections 历史使用最大连接数
可以看到 Max_used_connections 513 以超过 max_connections 512
修改配置文件, my.conf 等待下次重启
max_connections = 4096 max_user_connections = 4096
如果不想重启可以登录mysql直接修改
MySQL [(none)]> set GLOBAL max_connections=4096; Query OK, 0 rows affected (0.00 sec) MySQL [(none)]> show variables like '%max_connections%'; +-----------------------+-------+ | Variable_name | Value | +-----------------------+-------+ | extra_max_connections | 1 | | max_connections | 4096 | +-----------------------+-------+ 2 rows in set (0.00 sec)
评论前必须登录!
注册