Option 1: You can try running
lsof on MySQL’s pid, piped to
These will give you the list of open files (including sockets, etc.; everything is a file in Unix/Linux).
The open files limit can be checked on the
show global varaibles like '%files%' and then
set global variable open_files_limit=<some-larger-number>
Be careful about this, since the number from
ulimit -n is a total for the shell for all processes, and you don’t want to put it too high.
If you see this number slowly increasing, you probably want to check your code: there are dangling references.