MySQL can't open files after updating server: errno: 24

OS: Ubuntu (Debian) deployments

MySQL Server Option: open-files-limit

It seems that the Debian upstart doesn't use the parameters defined in /etc/security/limits.conf, so when you launch mysql through the service command (and so, under upstart), it overrides those defined limits and uses the default 1024.

The solution is to modify the mysql.conf file that defines the upstart service, it is located in /etc/init/mysql.conf and add the following lines before the pre-start block:

# NB: Upstart scripts do not respect
# /etc/security/limits.conf, so the open-file limits
# settings need to be applied here.
limit nofile 32000 32000
limit nproc 32000 32000

References:

  • https://serverfault.com/questions/440878/changing-open-files-limit-in-mysql-5-5
  • http://dev.mysql.com/doc/refman/5.5/en/server-options.html#c12634

Had the same problem on Ubuntu 15.10.

https://bugs.launchpad.net/ubuntu/+source/mysql-5.6/+bug/1434758 - brought the solution:

  1. check if /lib/systemd/system/mysql.service or /lib/systemd/system/mysqld.service is existing
  2. (in my case) if not, create /lib/systemd/system/mysql.service and copy content of to this file https://bugs.launchpad.net/ubuntu/+source/mysql-5.6/+bug/1434758/comments/11 and add the two lines somewhere in the file

    LimitNOFILE=infinity
    LimitMEMLOCK=infinity
    
  3. if one or both files existing, check if this two lines are included:

    LimitNOFILE=infinity
    LimitMEMLOCK=infinity
    
  4. execute systemctl daemon-reload

... and everything should be fine.