[MySQL/MariaDB/CentOS 7] mysqldump: Couldn’t execute XXXXX (Errcode: 24 “Too many open files”) (23)

MySQL/MariaDB will sometimes hit its open file limit when doing large mysqldump operations. On a lot of distributions you can raise the limit by adding the following line to the /etc/my.cnf file and restarting the service:

open_files_limit=XXXX

This doesn’t work on systemd controlled database services so you need to add the following lines to /etc/systemd/system/mariadb.service.d/limits.conf and then restart the service for the new limit to take effect:

[Service]

LimitNOFILE=XXXX

You can verify the new file limit with the following command:

MariaDB [(none)]> SHOW VARIABLES LIKE ‘Open_files_limit’;

+——————+——-+

| Variable_name    | Value |

+——————+——-+

| open_files_limit | 10000 |

+——————+——-+

1 row in set (0.00 sec)