解決問題: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)

 

 

 

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