mysqldump errno: 24 Can’t open file when using LOCK TABLES

When backing up a MySQL database using mysqldump command, I got the following error.

The error is due to open_files_limit

You need to edit mysql configuration file and increase value of open_files_limit.

Another way to fix the error is to use –lock-tables=false option when taking MySQL backup.


If you are using systemd, you may need to edit the service file. Identify which service file you are using with command

Now edit the service file with

In the above command replace mysqld with the name of your service. This can be mariadb or mysql depending on your OS. You will get an editor, in the editor, paste the following, save and exit the editor.

Restart MySQL

To change open_file_limit on MariaDB, see MariaDB Change Open Files Limit

Back to MySQL Backup

Need help with Linux Server or WordPress? We can help!

Leave a Reply

Your email address will not be published. Required fields are marked *