Errno:24 means ' Too many open files '. Everything in Linux is a file (or rather a file descriptor).
Every MySQL connection, Every Apache connection etc.
By default Ubuntu allows users to open 1024 files. The hard limit is 8192. So if you start to hear the melodies of errno it probably time to start increasing this limit
To I many files a user has open try this
sudo lsof-u MySQL
Edit the file in/etc/security/limits.conf and add two MySQL lines in the bottom
# @student-maxlogins 4
MySQL Soft nofile 4096
MySQL Hard nofile 8192
# End of File
There is some debate as to whether you need to reboot for this to take effect (I say debate, I rebooted, and didnt google For it as I am in a rush YMMV).
Once this are set you need to make some changes in the MySQL file as. Assuming yours lives in/etc/mysql/my.cnf-edit or add these values
Open-files-limit = 2048
Table_cache = 512
The Table_cache should be researched (start here:http://dev.mysql.com/doc/refman/5.0/en/table-cache.html) and changes Monitored. The default value is should a safe bet to begin with.