MySQL - can't raise max connections over 214

If you see that you're unable to raise max_connections over 214 with MySQL / Percona, it is probably because of restrictions in your mysql systemd file. Note: older distributions without systemd may have these limits applied in /etc/security/limits.conf.


In /lib/systemd/system/mysql.service, try adding "LimitNOFILE=infinity", so that your file looks like below (please note this file will likely be overwritten after you upgrade MySQL / Percona, so make sure to readd it if needed):

#
# Percona Server systemd service file
#

[Unit]
Description=Percona Server
After=network.target

[Install]
WantedBy=multi-user.target

[Service]
Type=forking
User=mysql
Group=mysql
PermissionsStartOnly=true
EnvironmentFile=-/etc/default/mysql
ExecStartPre=/usr/share/mysql/mysql-systemd-start pre
ExecStartPre=/usr/bin/ps_mysqld_helper
ExecStart=/usr/sbin/mysqld --daemonize --pid-file=/var/run/mysqld/mysqld.pid $MYSQLD_OPTS
TimeoutSec=600
Restart=on-failure
RestartPreventExitStatus=1

LimitNOFILE=infinity


Then, reload systemd configuration and restart mysql:

# systemctl daemon-reload
# systemctl restart mysql


Verify like below:

mysql> SHOW GLOBAL VARIABLES LIKE 'max_connections' ;
+-----------------+-------+
| Variable_name   | Value |
+-----------------+-------+
| max_connections | 12288 |
+-----------------+-------+
1 row in set (0.01 sec)