mysql报错Buffered warning: Changed limits: max_open_files: 1024

环境:mysql 5.6,centos 7

mysql日志报错:
2017-10-26 08:50:34 15782 [Warning] Buffered warning: Changed limits: max_open_files: 1024 (requested 5000)
2017-10-26 08:50:34 15782 [Warning] Buffered warning: Changed limits: table_open_cache: 431 (requested 1024)

解决办法:

vi /etc/security/limits.conf
增加以下两行
mysql hard nofile 65535
mysql soft nofile 65535

vi /usr/lib/systemd/system/mysqld.service
增加下面一行
LimitNOFILE=65535

# systemctl daemon-reload
# systemctl restart mysql.service

重启服务器,问题解决。