MySQL出现连接数太大时 修改链接数
报错信息
ERROR 1040 (HY000): Too many connections
连接数太大的时候 更改一下MySQL
在Linux下尝试进入MySQL服务
mysql -uroot -p
Enter password:
ERROR 1040 (HY000): Too many connections
如果还是出现以上错误信息
重启MySQL服务
/etc/init.d/mysql restart
重新登陆MySQL服务
mysql -uroot -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 20
Server version: 5.7.30-0ubuntu0.16.04.1 (Ubuntu)
Copyright (c) 2000, 2020, Oracle and/or its affiliates. All rights reserved.
Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.
Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.
mysql>
使用命令 将连接数提高
查看连接数
>> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 151 |
+-----------------+-------+
修改链接数
>> set GLOBAL max_connections=3600;
查询是否完成更改
>> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
退出
>> exit