Article ID: 127791, created on Dec 17, 2015, last review on Dec 17, 2015

  • Applies to:
  • Plesk Automation 11.5

Symptoms

The daemon mysqld refuses new connections. The following errors present in the /var/log/mysqld.log file:

151217 21:34:00 [ERROR] /usr/libexec/mysqld: Can't open file: './site1_db/fwriv_session.frm' (errno: 24)
151217 21:34:03 [ERROR] /usr/libexec/mysqld: Can't open file: './site2_db1/wcc_options.frm' (errno: 24)
151217 21:34:03 [ERROR] /usr/libexec/mysqld: Can't open file: './site2_db1/wcc_options.frm' (errno: 24)

If try to open MySQL shell by running mysql -uroot -p command, it takes 1-3 minutes to log in. When running show databases command it shows the following error:

mysql> show databases;
ERROR 1018 (HY000): Can't read dir of '.' (errno: 24)

Cause

The limit for maximum number of open files was exceeded by mysqld:

#  lsof -u mysql |wc -l
1050

The mysqld daemon cannot open another files since maximum number of open file descriptors was reached.

Resolution

  1. Increase maximum number of open file descriptors for the mysql user in the operating system. To do this add the following lines to the /etc/security/limits.conf file:

    mysql   soft    nofile  4096
    mysql   hard    nofile  8192
    
  2. Set up new limits in /etc/my.cnf:

    open-files-limit = 4096
    table_cache = 1024
    
  3. Restart mysqld:

    # service mysqld restart
    
  4. Check current number of opened files:

    # lsof -u mysql |wc -l
    1941
    

Search Words

[ERROR] /usr/libexec/mysqld:

(errno: 24

Can't read dir of '.'

ERROR 1018 (HY000)

mysql fails

cannot login to mysql

Can't open file:

cannot connect to mysql

ERROR 1018 (HY000): Can't read dir of '.' (errno: 24)

33a70544d00d562bbc5b17762c4ed2b3 caea8340e2d186a540518d08602aa065 e0aff7830fa22f92062ee4db78133079

Email subscription for changes to this article
Save as PDF