Linux: Too many open files in Ubuntu

Skip to main content
Du bist hier:
Drucken

Linux: Too many open files in Ubuntu

Linux: Too many open files in Ubuntu

Error messages like these in the log files of MySQL/MariaDB or Apache:

Error: SQLSTATE[HY000]: General error: 23 Out of resources when opening file ‘/tmp/#sql_751_0.MYD’ (Errcode: 24 – Too many open files)

Solution:

Adjust /etc/security/limits.conf:
root soft nofile 800000
root hard nofile 1024000

Adjust /etc/mysql/my.cnf:
open_files_limit = 1024000

On systems with systemd (all current Ubuntu versions):
There, limits.conf does not apply to services. Therefore also set the limit for the database service, for example with systemctl edit mariadb (or systemctl edit mysql):

[Service]
LimitNOFILE=1024000

Then run systemctl daemon-reload.

then restart the server

Related Post