I'm running into issues because my open_files_limit for mysql is only 1024.

Centos 7, MySQL Community Server 5.6.22-log

It's actually a vps dedicated to mysql for a WHM server (remote mysql), but that should be beside the point.

Config files


open_files_limit = 100000
open-files-limit = 100000 #I've read that the dashes are required on older versions, but I threw it in anyway.
innodb_buffer_pool_size = 600M

# and the same for mysqld_safe
open_files_limit = 100000
open-files-limit = 100000


*       hard    nofile  100000
*       soft    nofile  100000

Command outputs

My os open_files_limit for root:

[root@mack ~]# ulimit -Hn -Sn
open files                      (-n) 100000
open files                      (-n) 100000

And then as mysql user:

[root@mack ~]# su mysql
bash-4.2$ ulimit -Hn -Sn
open files                      (-n) 100000
open files                      (-n) 100000

MySQL status:

[root@mack ~]# service mysql status
Redirecting to /bin/systemctl status  mysql.service
mysqld.service - MySQL Community Server
   Loaded: loaded (/usr/lib/systemd/system/mysqld.service; enabled)
   Active: active (running) since Wed 2014-12-24 10:41:09 EST; 40min ago
  Process: 2982 ExecStartPost=/usr/bin/mysql-systemd-start post (code=exited, status=0/SUCCESS)
  Process: 2970 ExecStartPre=/usr/bin/mysql-systemd-start pre (code=exited, status=0/SUCCESS)
 Main PID: 2981 (mysqld_safe)
   CGroup: /system.slice/mysqld.service
           ââ2981 /bin/sh /usr/bin/mysqld_safe
           ââ3268 /usr/sbin/mysqld --basedir=/usr --datadir=/var/lib/mysql --plugin-dir=/usr/lib64/mysql/plugin --log-error=/var/log/mysqld.log --open-files-limit=100000 --pid-file=/var/run/mysqld/mysqld.pid --socket=/var/lib/mysql/my...

Dec 24 10:41:08 mack systemd[1]: Starting MySQL Community Server...
Dec 24 10:41:09 mack mysqld_safe[2981]: 141224 10:41:09 mysqld_safe Logging to '/var/log/mysqld.log'.
Dec 24 10:41:09 mack mysqld_safe[2981]: 141224 10:41:09 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
Dec 24 10:41:09 mack systemd[1]: Started MySQL Community Server.

I've restarted mysql, stopped, checked status to make sure it stopped, then started it, and rebooted the whole system.

Evidence that my.cnf works:

mysql> show global variables like '%buffer_pool_size%';
| Variable_name           | Value     |
| innodb_buffer_pool_size | 629145600 |
1 row in set (0.00 sec)

Now here's where my blood pressure goes up:

mysql> show global variables like 'open%';
| Variable_name    | Value |
| open_files_limit | 1024  |
1 row in set (0.00 sec)

What am I missing? Is there another my.cnf that's overwriting my value?

[root@mack ~]# find / -name "*.cnf"

I looked into all of those and there is no mention of open_files_limit. For the heck of it, I grep'd through these looking for the setting:

[root@mack ~]# grep -r "open_files_limit" /etc
/etc/my.cnf:open_files_limit = 100000
/etc/my.cnf:open_files_limit = 100000
[root@mack ~]# grep -r "open_files_limit" /var
[root@mack ~]# grep -r "open_files_limit" /usr
/usr/share/vim/vim74/syntax/ora.vim:syn keyword oraKeywordUnd     _number_cached_attributes _offline_rollback_segments _open_files_limit
Binary file /usr/sbin/mysqld matches
Binary file /usr/sbin/mysqld-debug matches
Binary file /usr/bin/mysqlbinlog matches
/usr/bin/mysqld_safe:      --open_files_limit=*) open_files="$val" ;;

But nope, they don't affect it.

  • 1
    Here's a tidbit from the mysql log during restart: 2014-12-24 10:41:09 3268 [Warning] Buffered warning: Could not increase number of max_open_files to more than 1024 (request: 100000). This must mean MySQL is TRYING to increase its limit.
    – user24601
    Commented Dec 24, 2014 at 17:55

1 Answer 1


I needed to edit /usr/lib/systemd/system/mysqld.service and add


Then run systemctl daemon-reload and systemctl restart mysql.service.

Now the variable is capped at 65536 for some reason unknown, but I can live with that for now.

Found this at https://unix.stackexchange.com/questions/152186/mysql-max-open-files-more-than-1024#answer-157910

  • 4
    The /usr/lib/ file contains a warning not to edit it. For MariaDB on Centos7 I created a file at /etc/systemd/system/mariadb.service.d/limits.conf with the following content [Service] LimitNOFILE=infinity LimitMEMLOCK=infinity Commented Feb 14, 2017 at 11:15

Not the answer you're looking for? Browse other questions tagged or ask your own question.