Max_user_connections has been mentioned in the mysql manual. It is used to restrict user resources. How can we limit user resources? A small test is conducted here.
First, check the value of the global variable.
Mysql> select @ max_user_connections;
+ ------------------------ +
| @ Max_user_connections |
+ ------------------------ +
| 0 |
+ ------------------------ +
1 row in set (0.00 sec)
The default value is 0.
What does 0 mean? It does not limit user resources.
Here I will change its value and query it. Note that this change is invalid after the server is restarted. If you want to keep saving it, put it in the option file!
Mysql> set @ global. max_user_connections = 1;
Query OK, 0 rows affected (0.00 sec)
Mysql> select @ max_user_connections;
+ ------------------------ +
| @ Max_user_connections |
+ ------------------------ +
| 1 |
+ ------------------------ +
1 row in set (0.00 sec)
Now I can restart a connection.
C: \ Windows \ System32> mysql-uroot-pweb
ERROR 1203 (42000): User root already has more than 'max _ user_connections 'activ
E connections
This indicates that the user has reached the maximum number of connections and cannot connect to or own resources!
This parameter can only restrict resources as a whole, not a user. If you need to restrict a user, you can see it in the permission table.
Max_questions: 0
Max_updates: 0
Max_connections: 0
Max_user_connections: 0
These parameters can be used to restrict a user.
Max_connections refers to User restrictions on the entire server!