ERROR 1040 (HY000): Too many connections

ERROR 1040 (HY000): Too many connections

Error:
ERROR 1040 (HY000): Too many connections

Occurred:
Error occurred due to connection reached at maximum limit defined in configuration file of MySQL.

Solution:
Increase the current value of the variable “max_connections”.

Check the current value

mysql> show variables like 'max_connections%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1 |
+-----------------+-------+
1 row in set (0.00 sec)

Increase the value of parameter in configuration file or by command:

By Command:
mysql> SET GLOBAL max_connections = 100;
Query OK, 0 rows affected (0.00 sec)

mysql> show variables like 'max_connections%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 100 |
+-----------------+-------+

By Configuration file:
Edit the configuration file my.cnf.
vi /etc/my.cnf
Find the variable max_connections under mysqld section.
[mysql]
max_connections = 100
Set into higher value and save the file

Note: If you set max_connection = 1, so MySQL will consider maximum allowed 2 connection. Extra One for Super User.

Advertisements