mysqldump: Error: ‘Out of resources when opening file ‘/tmp/#sql_466b_2.MAI’

While creating of backup of mysql I was getting below error

mysqldump: Error: ‘Out of resources when opening file ‘/tmp/#sql_466b_2.MAI’ (Errcode: 24 “Too many open files”)’

The error is due to Mysql exceeding the limit of open files on mysql

So I just went ahead and saw the open file limit

MariaDB [(none)]> SHOW VARIABLES LIKE ‘open%’
->
-> ;
+——————+——-+
| Variable_name | Value |
+——————+——-+
| open_files_limit | 1024 |
+——————+——-+
1 row in set (0.00 sec)

 

I went ahead and added a parameter in /etc/my.cnf and restarted mysql to fix this issue

open_files_limit = 5000