Reasonable setup of max_connections and max_user_connections and MySQL server maximum connection number in MySQL

Source: Internet
Author: User

max_connections refers to the maximum number of connections for the entire MySQL server;

max_user_connections refers to the maximum number of connections per database user, such as: Virtual host can use this parameter to control the maximum number of database connections per virtual host user;

MySQL server connection number is not to reach the maximum of 100%, or to specific problems specific analysis, the following on the MySQL server maximum connection number of reasonable settings for your reference.

We often meet the "mysql:error 1040:too Many connections" situation, one is that the traffic is really high, MySQL server can not resist, this time to consider increasing the spread from the server to read pressure, Another scenario is that the max_connections value in the MySQL configuration file is too small:

Mysql>Show variables like 'max_connections';+-----------------+-------+|Variable_name|Value|+-----------------+-------+|Max_connections|  the |+-----------------+-------+

the maximum number of connections for this MySQL server is 256, then query the maximum number of connections the server responds to:

MySQL>like'max_used_connections';

The maximum number of connections the MySQL server responds to is 245, does not reach the maximum number of server connections 256, should not appear 1040 error, the more ideal setting is:

/ *  - %  - %

The number of response connections accounted for about 85% of the maximum number of connections, if the ratio is found below 10%, MySQL server connection is set too high.

Reasonable setup of max_connections and max_user_connections and MySQL server maximum connection number in MySQL

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.