Symptoms
You may receive errors like the following on your website, or when trying to access MySQL from the command line or phpMyAdmin.
CONFIG_TEXT: mysqli_connect(): (08004/1040): Too many connections
CONFIG_TEXT: mysqli_real_connect(): (HY000/1040): Too many connections
Description
This occurs when MySQL has reached its max_connections limit. Once the limit is reached, MySQL will no longer accept connections.
Workaround
-
Check for sleeping queries with the following command.
# mysql -e "show processlist"|grep -c Sleep
-
Compare that against the max_connections setting for MySQL.
# mysql -e "show variables like 'max_connections'"
- Edit /etc/my.cnf.
- If a large portion of the max_connections is being used by sleeping queries, you might consider lowering the wait_timeout setting.
- If there are not many sleeping queries, or if you have server resources to spare, you might consider raising the max_connections setting.
-
Restart MySQL.
# /scripts/restartsrv_mysql
Comments
0 comments
Article is closed for comments.