Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

MySQL max_user_connections vs max_connections

Tags:

php

mysql

SADLY i could not find any straight-forward explanation to this query anywhere, not even in MySQL documentations.

Some people in various forums said max_user_connections can never be greater than max_connections? For example: if one user has 3 max_user_connections and another user has 15 max_user_connections, then they say the max_connections must be at least above 3+15 = 18.

However, mysql doc says, max allowed value of max_user_connections is 4294967295 which is MUCH LARGER THAN the max allowed value of max_connections is 100000.

Can somebody please explain how do these two options in MySQL impact one another.

like image 951
Rakib Avatar asked May 03 '15 22:05

Rakib


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.

What is the best max connections in MySQL?

By default 151 is the maximum permitted number of simultaneous client connections in MySQL 5.5. If you reach the limit of max_connections you will get the “Too many connections” error when you to try to connect to your MySQL server. This means all available connections are in use by other clients.

How do I find the maximum DB connections in MySQL?

To open for more connections, you can set a higher value for max_connections . To see the current value of max_connections , run this command: SHOW VARIABLES LIKE "max_connections"; By default, it's set to 151.


1 Answers

max_user_connections

One means of restricting client use of MySQL server resources is to set the global max_user_connections system variable to a nonzero value. This limits the number of simultaneous connections that can be made by any given account, but places no limits on what a client can do once connected. In addition, setting max_user_connections does not enable management of individual accounts. Both types of control are of interest to MySQL administrators.

max_connections

The maximum permitted number of simultaneous client connections. By default, this is 151


comment by dagon :

max_connections = the total connection limit
max_user_connections = the per user limit


Hence, the value of max_user_connections must never exceed the value of max_connections.

like image 120
Pedro Lobito Avatar answered Sep 17 '22 15:09

Pedro Lobito