[How-to-fix] mysql ERROR 1040 (00000): Too many connections
[root@ddos ~]# mysql -u root -p
Enter password:
ERROR 1040 (00000): Too many connections
[root@ddos ~]# vi /etc/my.cnf
max_connections=1000
max_user_connections=300
[root@ddos ~]# service mysqld stop
Shutting down MySQL….
[root@ddos ~]# service mysqld start
Starting MySQL.
[root@ddos ~]# mysql -u root -p
Enter password:
Welcome to the MySQL monitor. Commands end with ; or \g.
Your MySQL connection id is 2
Server version: 5.1.55-log Source distributionCopyright (c) 2000, 2010, Oracle and/or its affiliates. All rights reserved.
This software comes with ABSOLUTELY NO WARRANTY. This is free software,
and you are welcome to modify and redistribute it under the GPL v2 license
Type ‘help;’ or ‘\h’ for help. Type ‘\c’ to clear the current input statement.
mysql>
select
restart Mysql :: mysql restart
Error Message:mysql ERROR 1040 (00000): Too many connections
When problems occur, to avoid abnormal situation, first restart Mysql service
[root@ddos ~]# service mysqld restart
[root@ddos ~]# mysql -u root -p
mysql> select @@global.max_connections;
+————————————–+
| @@global.max_connections |
+————————————–+
| 150 |
+————————————–+
// The max connection is 150, now, i need to change it to 500.
mysql> set global max_connections=500;
Query OK, 0 rows affected (0.00 sec)