MySQL 关于 max_open_files 和 table_open_cache 的警告

MySQL warnings about max_open_files and table_open_cache

我在 Ubuntu 18 上有一个 MySQL 5.7 服务器。当服务器启动时,它会在 error.log 中写入以下警告:

[Warning] Changed limits: max_open_files: 5000 (requested 7500)
[Warning] Changed limits: table_open_cache: 1745 (requested 2000)

有人可以解释是什么导致了这些警告(以及我可以做些什么来让它们消失)?

回答我自己的问题。最大打开文件的限制在 systemd 脚本中定义 /lib/systemd/system/mysql.service:

# MySQL systemd service file

[Unit]
Description=MySQL Community Server
After=network.target
....

LimitNOFILE=5000

将 LimitNOFILE 的值增加到 7500 解决了这两个警告。