Plesk is inaccessible: SQLSTATE[08004] [1040] Too many connections error is shown in Plesk interface

Created:

2016-11-16 13:05:17 UTC

Modified:

2017-08-23 01:18:08 UTC

26

Was this article helpful?


Have more questions?

Submit a request

Plesk is inaccessible: SQLSTATE[08004] [1040] Too many connections error is shown in Plesk interface

Applicable to:

  • Plesk for Linux

Symptoms

The following error appear in the Plesk interface:

PLESK_INFO: Unable to connect to database: Too many connections
SQLSTATE[08004] [1040] Too many connections

Cause

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.

Resolution

  1. Connect to the server using SSH .
  2. Check the number of current connections to the server, use:

    # 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 i, the file

    For RHEL-based systems:
    /etc/my.cnf
    For Debian-based systems:
    /etc/mysql/my.cnf
    For example:

    CONFIG_TEXT: [mysqld]
    max_connections=150
    max_user_connections=20

  3. Restart MySQL after my.cnf has been modified:

    # service mysqld restart

  4. 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.

    You can check which users/requests slow MySQL on all current connections with the following command:

    # mysqladmin -uadmin -p`cat /etc/psa/.psa.shadow` processlist

Additional information

Plesk or website are not working: Unable to connect to database MySQL server has gone away: Full server backup is created with warning: errno: 24 - Too many open files

Have more questions? Submit a request
Please sign in to leave a comment.