I've read both of these related questions and still stuck:
- https://dba.stackexchange.com/questions/86987/mysql-open-files-limit-cannot-change-this-variable/86988#86988?newreg=71bfff05b6284cb4be6b5b5cdb6c7f45
- https://stackoverflow.com/questions/22495124/cannot-set-limit-of-mysql-open-files-limit-from-1024-to-65535/35515570#35515570
MySQL table_open_cache is set to 8000
in /etc/mysql/mysql.conf.d/mysqld.cnf
and this value is not defined in any of the other loaded cnf files:
table_open_cache = 8000
Also, in /lib/systemd/system/mysql.service
I have the default entry:
LimitNOFILE=10000
When I query variables from the cli I still get this:
mysql> show variables like 'table_open_cache';
+------------------+-------+
| Variable_name | Value |
+------------------+-------+
| table_open_cache | 4745 |
+------------------+-------+
Also there's this:
$ ulimit -n
1024
Which is confusing because if the open files limit was being restricted by system shouldn't I be capped at 1024 instead of 4745? I don't understand where 4745 is even coming from.
Can someone please explain what's going on here? Is this a MySQL configuration problem or a limit being imposed by the operating system? I just migrated from Ubuntu 16.04 with nearly identical config and this was not a problem before.
OS is Ubuntu 20.04. MySQL version is 8.0.20.