解决问题:mysql 1040 too many connections

数据库连接数过多,无法进入MYSQL控制台

[root@master ~]# mysql -u root -p
Enter password: 
ERROR 1040 (HY000): Too many connections

停止程序, 重启mysql

Nov 27 16:11:15 master systemd[1]: Started MySQL Server.
[root@master ~]# service mysqld stop
Redirecting to /bin/systemctl stop mysqld.service
[root@master ~]# service mysqld start
Redirecting to /bin/systemctl start mysqld.service

进入控制台

[root@master ~]# mysql -hIP -uroot -p密码
mysql: [Warning] Using a password on the command line interface can be insecure.
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 22
Server version: 5.7.28 MySQL Community Server (GPL)

Copyright (c) 2000, 2019, 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   |
+-----------------+-------+
1 row in set (0.01 sec)

修改最大连接数

mysql> set GLOBAL max_connections=1000;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like "max_connections";
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 1000  |
+-----------------+-------+
1 row in set (0.01 sec)

 

 

 

發表評論
所有評論
還沒有人評論,想成為第一個評論的人麼? 請在上方評論欄輸入並且點擊發布.
相關文章