修改MySQL的连接数


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

文章作者: 柒仔
文章链接: /article/11/
版权声明: 本博客所有文章除特別声明外,均采用 CC BY 4.0 许可协议。转载请注明来源 XiaoLiu!
侵权声明: 若无意对您的文章造成侵权,请您留言,博主看到后会及时处理,谢谢。
评论-----昵称和邮箱必填,网址选填
  目录