- Plesk for Linux
- The following error appears in the Plesk interface on Linux:
CONFIG_TEXT: Unable to connect to database: Too many connections
SQLSTATE  Too many connections
- Additionally, migration of objects (mailboxes, databases, etc) fails with the same error as shown above
This error means that the maximum number of simultaneous connections to the MySQL server has been reached. New connections to the server cannot be established at this time.
Note: To apply the solution from this article, it is required to have SSH access to the server. Please contact your hosting provider support or server's administrator if you don't have SSH access or ask them to apply the solution.
First of all, make sure that the error is the same as in the title and Plesk is installed on the server.
Connect to the server using SSH and choose the best solution for you:
Download, unzip and run automatic script that will set the MySQL parameter
max_connections to 300:
# wget https://support.plesk.com/hc/article_attachments/360003572374/maxconn.zip
# unzip maxconn.zip
# chmod +x maxconn
Note: If the automatic solution did not help, apply the manual solution below.
Check the number of current connections to the server:
# mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` extended-status | grep Max_used_connections
| Max_used_connections | 11 |
The current connection limit can be found using:
# mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow ` variables | grep 'max.*connections'
| max_connections | 100 |
| max_user_connections | 0 |
In the above example, the maximum number of connections to the server (
max_connections) is set to 100. The maximum number of connections per user (
max_user_connections) is zero, which means unlimited. The default MySQL values can be redefined in the file:
/etc/my.cnfon RHEL-based operating systems.
/etc/mysql/my.cnfon Debian and Ubuntu.
Set it as below under the section
Warning: if you set the connection limit to a very high value (more than 300), this may affect server performance. It is better to find and rectify the cause of the high MySQL server usage.
To check which users/requests slow MySQL on all current connections, use the following command:
# mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` processlist
Restart MySQL service to apply the changes:
# service mysqld restart
# service mariadb restart
Note: The service can be also called
mysqldepending on the operating system and used MySQL server version or drop-in replacement.
If the issue persists, restart MySQL, login to Plesk database and set the value:
# plesk db
mysql> SET GLOBAL max_connections = 1024;
If the issue still persists, make sure that there is enough disk space.
# df -h
# df -i