How to fix the «Could not increase number of max_open_files to more than 1024» MySQL issue?

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.

unix.stackexchange.com/a/157910

The full solution for Ubuntu 20.