I’m trying to change max_connections
and open_files_limit
for MariaDB version 5.5.60 on CentOS 7.
Since there could be multiple my.cnf files, I used mysql --help --verbose
to get possible locations. Here’s the output:
Default options are read from the following files in the given order: /etc/mysql/my.cnf /etc/my.cnf ~/.my.cnf
The /etc/mysql/my.cnf doesn’t exist and .my.cnf isn’t in my user directory, /root/ or mysql user’s directory (which doesn’t exist to begin with).
So I’m left with /etc/my.cnf. This is what it looks like:
[mysqld] datadir=/data/mysql socket=/var/lib/mysql/mysql.sock # Disabling symbolic-links is recommended to prevent assorted security risks symbolic-links=0 max_connections = 5000 open_files_limit = 10240 # Settings user and group are ignored when systemd is used. # If you need to run mysqld under a different user or group, # customize your systemd unit file for mariadb according to the # instructions in http://fedoraproject.org/wiki/Systemd [mysqld_safe] log-error=/var/log/mariadb/mariadb.log pid-file=/var/run/mariadb/mariadb.pid # # include all files from the config directory # !includedir /etc/my.cnf.d
The /etc/my.cnf.d from the last line contains server.cnf, which includes these two lines:
[server] max_connections=5000 open_files_limit=10240
However, when I run systemctl restart mariadb
, only the max_connections is changed, but I just can’t get it to read the new value of open_files_limit
.
It keeps doing this:
MariaDB [(none)]> SHOW VARIABLES LIKE 'open_files_limit'; +------------------+-------+ | Variable_name | Value | +------------------+-------+ | open_files_limit | 1024 | +------------------+-------+ 1 row in set (0.00 sec)
Do you have any idea why it’s doing this and how I could get the server to read the new value of open_files_limit
?
Thank you in advance
Sasha
Answers:
Thank you for visiting the Q&A section on Magenaut. Please note that all the answers may not help you solve the issue immediately. So please treat them as advisements. If you found the post helpful (or not), leave a comment & I’ll get back to you as soon as possible.
Method 1
The value of open_file_limits variable can’t be higher than your system limits.
Check output of ulimit -n
and change your system configuration. Preferable assign these limits not system wide, but for the user under which MariaDB server is running.
All methods was sourced from stackoverflow.com or stackexchange.com, is licensed under cc by-sa 2.5, cc by-sa 3.0 and cc by-sa 4.0