Edit /etc/security/limits.conf
and add the following lines
mysql soft nofile 65535
mysql hard nofile 65535
then reboot.
Then edit /usr/lib/systemd/system/mysqld.service
or /usr/lib/systemd/system/mariadb.service
and add
LimitNOFILE=infinity
LimitMEMLOCK=infinity
Then restart the db service:
systemctl reload mariadb.service
systemctl reload mysql.service