Server Fault is a question and answer site for system and network administrators. Join them; it only takes a minute:

Sign up
Here's how it works:
  1. Anybody can ask a question
  2. Anybody can answer
  3. The best answers are voted up and rise to the top

When I set open_files_limit = 16k in both: /etc/security/limits.conf and /etc/mysql/my.cnf

ulimit -n

but in mysql:

show variables like 'open_files_limit';
open_files_limit: 4096 

So how does mysql calculate open_files_limit. Is there somewhere else I should be looking?

share|improve this question
would you have to restart mysql once to take effect? – JoseK Sep 27 '10 at 8:25
I did and tried restarting the server. – Mario Michelli Sep 27 '10 at 10:37

Option 1: You can try running lsof on MySQL’s pid, piped to wc -l.

Option 2: ll /proc/<mysql-pid>/fs/

These will give you the list of open files (including sockets, etc.; everything is a file in Unix/Linux).

The open files limit can be checked on the mysql-client using show global varaibles like '%files%' and then set global variable open_files_limit=<some-larger-number>

Be careful about this, since the number from ulimit -n is a total for the shell for all processes, and you don’t want to put it too high.

If you see this number slowly increasing, you probably want to check your code: there are dangling references.

share|improve this answer

Did you specify it as open_files_limit or open-files-limit in my.cnf? In config file it should be open-files-limit.

share|improve this answer

check limits for user mysql:

limits -e -U mysql

ulimit -a - show limits for your user

If limits correct && you use Percona MYSQL then need activate limits in start script.

For example in FreeBSD: /usr/local/etc/rc.d/mysql-server find string: ${mysql_limits="NO"} and replace NO -> YES

PS. 2Janne Pikkarainen in my config my.cnf: open_files_limit = 8192

share|improve this answer

Your Answer


By posting your answer, you agree to the privacy policy and terms of service.

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