Out of resources when opening file
Production Risk
High — table access fails; workload is blocked.
ER_OUT_OF_RESOURCES (1041, SQLSTATE HY000) is raised when MySQL cannot open a file because the OS file descriptor limit has been reached.
- 1OS open file descriptor limit (ulimit -n) is too low for the workload
- 2Too many tables open simultaneously exceeding table_open_cache
- 3MySQL data directory has too many table files
-- No single trigger SQL; occurs under heavy concurrent table access
expected output
ERROR 1041 (HY000): Out of resources when opening file './db/tablename.ibd' (Errcode: 24 - Too many open files)
Fix
Increase the OS file descriptor limit
WHEN Errcode 24 (too many open files) appears.
-- In /etc/security/limits.conf: -- mysql soft nofile 65535 -- mysql hard nofile 65535 -- Also set in my.cnf: -- open_files_limit = 65535
Why this works
MySQL needs one file descriptor per open table file; raising the OS limit allows more tables to be open simultaneously.
✕ Set table_open_cache to an extremely large value without raising open_files_limit
table_open_cache determines how many file descriptors MySQL tries to keep open; it must not exceed the OS ulimit.
MySQL 8.0 — 1041 ER_OUT_OF_RESOURCES
Content generated with AI assistance and reviewed for accuracy. Found an error? hello@errcodes.dev