Symptoms

MySQL database related error messages appear on websites from time to time. Example of the error message:

Can't open file: './db123456_dbname/table001.frm' (errno: 24)

Cause

Limit on number of open files was reached on the MySQL server where the customer's database in question is hosted.

Resolution

Increase the number of open files on the MySQL server where the customer's database in question is hosted:

  1. Log in to the MySQL server where the database is hosted

  2. Find the current value of the open_files_limit parameter (the default value is 1024):

    mysql> SHOW VARIABLES LIKE 'open_files_limit';
    +------------------+-------+
    | Variable_name    | Value |
    +------------------+-------+
    | open_files_limit | 1024  |
    +------------------+-------+
    1 row in set (0.00 sec)
    
  3. Open the /etc/my.cnf file and check if the open_files_limit is defined there. If not, then add the line 'open_files_limit = 10000' to the configuration file (you can use some greater value if 10000 is not enough).

  4. Restart MySQL server:

    # /etc/init.d/mysql restart
    
  5. Check if database errors still occur. If they do, try to increase the open_files_limit again.

Internal content

Link on internal Article