Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

How to solve MySQL max_user_connections error

Tags:

mysql

I'm getting following error when I try to log onto phpMyAdmin.

User ** already has more than 'max_user_connections' active connections

Could anyone let me know how to close these DB connections from MySQL server end?

Thank you for your time!

like image 865
Yasiru G Avatar asked Jun 25 '12 05:06

Yasiru G


People also ask

What is Max_user_connections in MySQL?

For MAX_USER_CONNECTIONS , the limit is an integer representing the maximum number of simultaneous connections by the account. If this limit is set to zero, the global max_user_connections system variable value determines the number of simultaneous connections.

How do I increase max user connections?

mysql> set global max_connections = 200; The above command will increase max connections without restart but once the server is restarted, the changes will be gone. This method is useful to increase available connections in a production system such as a website/app, without having to restart your database server.


1 Answers

Read max_connections document to solve your problem

If clients encounter Too many connections errors when attempting to connect to the mysqld server, all available connections are in use by other clients.

The permitted number of connections is controlled by the max_connections system variable. The default value is 151 to improve performance when MySQL is used with the Apache Web server. To support more connections, set max_connections to a larger value.

First: Check your current database max_connection variable

SHOW VARIABLES LIKE 'max_connections';
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 151   |
+-----------------+-------+

Then Try to increase the max_connection parameter either with running command like:

 SET GLOBAL max_connections = 300;

Or set this parameter in my.cnf that located at /etc/my.cnf

vi /etc/my.cnf
max_connections = 300

Finally: Restart mysql service

like image 64
osyan Avatar answered Oct 14 '22 02:10

osyan