I opened the website early this morning and found that the dynamic page showed the ERROR 1040: Too connector connections prompt. This is not the reason for Too many connections. I don't have a few IP addresses in my blog every day, how can this problem be immediately viewed on vps.
The error message is as follows:
#/Home/binbin. zhengbb/ssh/update_dns.sh
ERROR 1040 (08004): Too connector connections
ERROR 1040 (08004): Too connector connections
One reason for this error is that the access volume is indeed high and the MySQL server cannot withstand it. In this case, we need to consider increasing the distributed read Pressure on the slave server, the value of max_connections In the MySQL configuration file is too small.
Query the maximum number of connections of MySQL:
The Code is as follows: |
Copy code |
Mysql> show variables like 'max _ connections '; + ----------------- + ------- + | Variable_name | Value | + ----------------- + ------- + | Max_connections | 100 | + ----------------- + ------- + 1 row in set (0.00 sec) |
Query the maximum number of MySQL response connections:
The Code is as follows: |
Copy code |
Mysql> show global status like 'max _ used_connections '; + ---------------------- + ------- + | Variable_name | Value | + ---------------------- + ------- + | Max_used_connections | 5 | + ---------------------- + ------- + 1 row in set (0.00 sec) |
Note: There is no reference value for the local environment. However, in terms of the above data, the maximum number of connections responded by MySQL in the past is less than the maximum number of connections allowed by MySQL. Therefore, no 1040 error occurs.
The ideal Calculation Method for the maximum number of connections in MySQL is:
Max_used_connections/max_connections * 100% ≈ 85%.
That is, the maximum number of connections accounts for about 85% of the maximum number of connections. If the percentage is less than 10%, the upper limit of the number of connections of the MySQL server is too high.
Method 1: directly modify mysql
The Code is as follows: |
Copy code |
Mysql> show variables; | Max_connections | 100 Mysql> set GLOBAL max_connections = 1500; |
Method 2: modify the configuration file
The Code is as follows: |
Copy code |
[Intranets root @ inc-dp-149-47/root] # Vi/etc/my. cnf [Mysqld] Datadir =/var/lib/mysql Socket =/var/lib/mysql. sock User = mysql # Default to using old password format for compatibility with mysql 3.x # Clients (those using the mysqlclient10 compatibility package ). Old_passwords = 1 Log-bin =/var/lib/mysql/mysql_bin_log/log-bin Expire_logs_days = 7 Log-slow-queries =/var/log/mysqld_slow_query.log Set-variable = max_connections = 1500 [Mysqld_safe] Log-error =/var/log/mysqld. log # Log-update =/var/log/mysqld_update.log Pid-file =/var/run/mysqld. pid |
Restart our mysql database server.