I have a large database dump I want to import with MariaDB / MySQL.

mysql -u DBUSER DBNAME < DUMP.sql

The process goes on for a while, and then I get this:

ERROR 23 (HY000) at line 11304: Out of resources when opening file './DBNAME/' (Errcode: 24 "Too many open files")

When this happened to me before, I simply split the file in half and imported both halves separately. But this seems like a poor workaround.

System: Linux Mint 17.3 Rosa


You will need to increase the openfiles in ulimit.

More detailed info here: https://duntuk.com/how-raise-ulimit-open-files-and-mysql-openfileslimit

  • Thanks! Can you summarize this in your answer? And when i have edited the file, do I need to reboot or something? Do I need to change the ulimit for myself or for mysql user? If what I want is run a mysql from the commandline.
    – donquixote
    Oct 20 '16 at 11:52
  • You will need to increase it for the user mysql and restart the service mysql for the changes to take effect.
    – Visu
    Oct 20 '16 at 18:43

Found a solution that works for me.

Edit /etc/mysql/my.cnf.

Old line was open-files-limit = 1000. Something in the docs talked about open_file_limit. The my.cnf also has innodb_open_files.

I am still not sure what is correct. Obviously the following is redundant, but it worked for me:

open-files-limit        = 20000
open_files_limit        = 20000

Others mention that one needs to look at file limits at the OS level, too..

  • Either syntax is accepted in my.cnf.
    – Rick James
    Oct 22 '16 at 23:37
  • open_files_limit comes from the OS's ulimit. Check out table_open_cache.
    – Rick James
    Oct 22 '16 at 23:37

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.