Symptoms
-
The following error message appears in the Plesk interface or during Plesk migration process:
PLESK_INFO: Unable to connect to database: Too many connections
SQLSTATE[08004] [1040] Too many connections -
Websites fail to load with the error:
PLESK_INFO: Error Establishing a Database Connection
-
Plesk license installation fails with the error:
PLESK_ERROR: Incorrect ServerInfo format (Error code: 2)
exit status 1
Cause
The maximum number of simultaneous connections to the MySQL server has been reached and new connections to the server cannot be established.
Resolution
For Plesk on Linux
Note: On Linux server with MySQL installed, the max_connections
limit cannot be higher than 214, unless the solution from this KB article is applied.
-
Connect to the Plesk server via SSH.
-
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
# ./maxconnNote: If the automatic solution did not help, apply the manual solution below.
-
Connect to the Plesk server via SSH.
-
Find the current
max_connections
value:# plesk db “SHOW VARIABLES LIKE ‘max_connections'”
+—————–+——-+
| Variable_name | Value |
+—————–+——-+
| max_connections | 151 |
+—————–+——-+ -
Open the MySQL configuration file
my.cnf
in a text editor. In this example, we are using the vi editor:-
on CentOS/RHEL-based distributions
# vi /etc/my.cnf
-
on Debian/Ubuntu-based distributions
# vi /etc/mysql/my.cnf
-
-
Increase the number of connections by adding this directive under the [MySQLD] section:
[mysqld]
max_connections=300 -
Save the changes and close the file.
-
Restart MySQL/MariaDB service to apply the changes using one of these commands:
# service mysql restart
# service mariadb restart
For Plesk on Windows Server
-
Connect to the Plesk server via RDP.
-
Open the MySQL configuration file
%plesk_dir%DatabasesMySQLmy.ini
in a text editor. -
Increase the number of connections by adding this directive under the [MySQLD] section (the default value is 300):
[MySQLD]
max_connections=300 -
Save the changes and close the file.
-
Restart the MySQL/MariaDB service.