Two weeks ago we bought new server, and since then When creating a large number of categories or tables, MySQL may surprisingly stop working and we may find this type of error on /var/lib/mysql/HOSTNAME.err:
131206 10:54:37 [ERROR] Error in accept: Too many open files
131206 10:58:53 [ERROR] Error in accept: Too many open files
131206 11:03:09 [ERROR] Error in accept: Too many open files
131206 11:07:25 [ERROR] Error in accept: Too many open files
131206 11:11:41 [ERROR] Error in accept: Too many open files
131206 11:15:58 [ERROR] Error in accept: Too many open files
131206 11:20:14 [ERROR] Error in accept: Too many open files
131206 11:24:30 [ERROR] Error in accept: Too many open files
131206 11:28:46 [ERROR] Error in accept: Too many open files
131206 11:33:02 [ERROR] Error in accept: Too many open files
If you are getting the above error this means that MySQL open file limit is very low.
By default a lot of Linux systems set the limit too low as you can check using following command:
ulimit -n
To increase open file limitations we can use several ways.
1-We can set the limit by using ulimit command
ulimit -n 4096
This is a temporary solution once you logged out and login again the value will set back to default.
2-For the Permanent solution we may define in /etc/security/limits.conf
We can define the value by adding following lines:
* soft nofile 100000 * hard nofile 100000
3- Then, be sure to restart MySQL to apply the changes.