Mysql – thesql says “too many open files” when importing large *.sql file

importMySQL

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

Best Answer

You will need to increase the openfiles in ulimit.

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