Differences between max_connections and max_user_connections in mysql

Source: Internet
Author: User
Tags mysql manual

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!

Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.