MySQL Error in accept: Too many open files

If you are getting the below error this means that MySQL open file limit if very low.

140821 22:38:08 [ERROR] Error in accept: Too many open files
140821 22:43:10 [ERROR] Error in accept: Too many open files
140821 22:50:49 [ERROR] Error in accept: Too many open files
140821 23:01:11 [ERROR] Error in accept: Too many open files
140821 23:08:49 [ERROR] Error in accept: Too many open files
140821 23:20:08 [ERROR] Error in accept: Too many open files
140821 23:29:03 [ERROR] Error in accept: Too many open files
140821 23:45:57 [ERROR] Error in accept: Too many open files
140822 0:01:02 [ERROR] Error in accept: Too many open files
[ERROR] /usr/sbin/mysqld: Can't open file:
[ERROR] /usr/sbin/mysqld: Can't open file:
[ERROR] /usr/sbin/mysqld: Can't open file:
[ERROR] /usr/sbin/mysqld: Can't open file:

 

You can find the current Open file limit using the command

mysqladmin variables |grep -i open_files_limit
| open_files_limit | 1024

Here the value is 1024 so we can increase it to 100000 by adding the line open_files_limit = 100000 under [mysqld]

vi /etc/my.cnf

Now add the line open_files_limit = 100000

Restart MySQL

/etc/init.d/mysql restart