我正在尝试增加到 9000,但 MariaDB 自动将其设置为 4895。
这是我的简单配置 https://pastebin.com/raw/4eFiuFSv
MySQLTuner 输出:
Control warning line(s) into /var/lib/mysql/cp.goal.ge.err file
Control error line(s) into /var/lib/mysql/cp.goal.ge.err file
Restrict Host for user@% to user@SpecificDNSorIp
Configure your accounts with ip or subnets only, then update your configuration with skip-name-resolve=1
Temporary table size is already large - reduce result set size
Reduce your SELECT DISTINCT queries without LIMIT clauses
Increase table_open_cache gradually to avoid file descriptor limits
Read this before increasing table_open_cache over 64:
Beware that open_files_limit (10000) variable
should be greater than table_open_cache (4895)
Optimize queries and/or use InnoDB to reduce lock wait
Consider installing Sys schema from https://github.com/mysql/mysql-sys
Variables to adjust:
query_cache_size (=0)
query_cache_type (=0)
query_cache_size (> 125M)
table_open_cache (> 4895)
我可以看到 MariaDB 可能重置此变量的 3 个不同原因。按照最不可能的解释顺序:
table_open_cache
变量设置为 4895。table_open_cache
. (不太可能!)此外,其他软件(例如 cPanel)可能会在 MariaDB 启动后动态更改变量。
要查看 MariaDB 服务器将从选项文件中获得哪些选项,请运行:
要查找 MariaDB 服务器正在查找 .cnf 文件的所有位置,请运行:
然后,您可以
grep
查看这些文件中的每一个是否找到table_open_cache
或的任何实例table-open-cache
。作为参考,您应该能够通过以下方式查看变量的当前值:
您可能还想查阅 MariaDB 知识库中的此页面:优化 table_open_cache。