Step 1
Add to /etc/init.d/mysql
(Ubuntu, Debian with SysVinit) or /usr/lib/systemd/system/mysql.service
(Ubuntu, Debian with Systemd) or /etc/systemd/system/mysqld.service.d/limits.conf
(CentOS):
LimitNOFILE=65535
LimitNPROC=65535
Step 2
Add to /etc/security/limits.conf
:
mysql soft nofile 65535
mysql hard nofile 65535
Step 3
Reboot.