mysql returns Can't read dir of '.' (errno: 24) when trying to run a simple query

Description

When trying to run a simple query or "SHOW DATABASES" command with MySQL's CLI, you get the following error:
ERROR 1018 (HY000) at line 1: Can't read dir of '.' (errno: 24)

/var/log/mysqld.log shows the following error:
130210 22:59:46 [ERROR] /usr/libexec/mysqld: Can't open file: './database/table.frm' (errno: 24)


Solution

OS error code 24 is actually: Too many open files

Edit /etc/my.cnf and increase open-files on [mysqld], i.e. add:
open-files=65536

Affected software:

MySQL 5.1.x
MySQL 5.5.x
MySQL 5.6.x






Add new comment
Name:
Anti-Bots verification code (just write 1234):