Reputation: 21493
I have setup max_connections=2000
in /etc/my.conf
and restarted mysqld
but still max_connections
apear to be stuck at 412
mysql> SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 412 |
+-----------------+-------+
1 row in set (0.01 sec)
mysql>
I have also tried restarting mysqld
post
mysql> SET GLOBAL max_connections = 2000;
but in I still get the max_connections | 412
from the query SHOW VARIABLES LIKE "max_connections";
Upvotes: 1
Views: 3212
Reputation: 727
Create an override for the service file
systemctl edit mysql.service
Add the following content
[Service]
LimitNOFILE=4096
Restart the MySQL server
service mysql restart
Upvotes: 4
Reputation: 21493
I solved this by changing system level limit on number of open files.
Check the system level. run command ulimit -a
output will be
core file size (blocks, -c) 0
data seg size (kbytes, -d) unlimited
scheduling priority (-e) 0
file size (blocks, -f) unlimited
pending signals (-i) 31168
max locked memory (kbytes, -l) 64
max memory size (kbytes, -m) unlimited
open files (-n) 1012
pipe size (512 bytes, -p) 8
POSIX message queues (bytes, -q) 819200
real-time priority (-r) 0
stack size (kbytes, -s) 8192
cpu time (seconds, -t) unlimited
max user processes (-u) 4096
virtual memory (kbytes, -v) unlimited
file locks (-x) unlimited
the open files
limit has to be more than value of max_connecitons
To change that do the following
sudo nano /etc/security/limits.conf
and add/edit
* hard nofile 4096
* soft nofile 4096
Now re-login to the server and restart mysqld
and check
mysql> SHOW VARIABLES LIKE "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 2000 |
+-----------------+-------+
1 row in set (0.01 sec)
mysql>
Upvotes: 2