Plesk

MySQL/MariaDB on the server with Plesk shows the error: Too many open files

Symptoms

Cause

The open files limit has been reached by the MySQL/MariaDB service. When MySQL fails to open required files, the process gets hanged and systemd fails to stop MySQL process.

Resolution

Warning: Increasing the open file limits might affect the amount of used connections. In order to avoid instability, consider increasing it as well by following instructions from this KB article.

Note: systemd operating systems have MariaDB installed by default. If MariaDB has been replaced by MySQL, follow the resolution steps for MySQL.

 

With MariaDB installed

 

  1. Connect to the server via SSH.

  2. Modify MariaDB startup script:

    # systemctl edit mariadb

  3. Set open files limit for the MariaDB service:

    [Service]
    LimitNOFILE=8192

  4. Restart the MariaDB service:

    # systemctl restart mariadb

  5. Verify the changes:

    # egrep "open files" /proc/$(cat `plesk db -Ne "show variables like 'pid_file'" | awk '{print $2}'`)/limits
    Max open files 8192 8192 files

 

With MySQL installed

 

  1. Connect to the server via SSH.

  2. Modify MySQL startup script:

    # systemctl edit mysql

  3. Set open files limit for the MySQL service:

    [Service]
    LimitNOFILE=8192

  4. Restart the MySQL service:

    # systemctl restart mysql

  5. Verify the changes:

    # egrep "open files" /proc/$(cat `plesk db -Ne "show variables like 'pid_file'" | awk '{print $2}'`)/limits
    Max open files 8192 8192 files

 

Exit mobile version