Raising mysql file handle limit

From snippet wiki
Jump to navigation Jump to search

Migrating to debian 8 (jessie) it might happen you run out of file handles for mysql. The default uses only 1024 which can be enough for human users bit isn't enough for a database.

Two places need some work:

In /etc/security/limits.conf add these lines

mysql           soft    nofile  40960
mysql           hard    nofile  40960

And create a file /etc/mysql/conf.d/own.cnf

[mysqld]
open_files_limit = 40960

Now you should restart the mysql server and it has way more files. If needed just enhance the value 40960 to whatever it needs.