mysqldump: Got error: 1016: Can’t open file: … (errno: 24) when using LOCK TABLES
Sometimes, when you have got a large number of tables in your database and while taking the dump of that particular database, you would have encountered this strange error
mysqldump: Got error: 1016: Can't open file: '.\database\certain_table.frm' (errno: 24) when using LOCK TABLES
There are two solutions to avoid this error
1. Set the following value to some higher number in your mysql database
set open-files-limit=20000
2. or, While taking the mysql dump, use –lock-tables=false option.
mysqldump --lock-tables=false -u root -p db-with-lots-of-tables > db.sql

5 responses to "mysqldump: Got error: 1016: Can’t open file: … (errno: 24) when using LOCK TABLES"
16:18 on January 9th, 2012
Actually the mysqldump flag is –lock-tables=false, not –lock-tables=off.
10:03 on January 12th, 2012
Hi, thanks for posting this solution it helped me out of a tight spot.
I should say though that possibly the MySQL version has changed since your post (not sure when this was posted?), but I had to set –lock-tables=false
I tried “off” first, and it gave me a message about invalid values and being ignored. Changing to “false” worked though.
Thanks again!
22:52 on January 12th, 2012
@Japh and @Luca,
Thanks, for old mysql databases i.e. 5.0.x it is –lock-tables=off.
Corrected.
13:27 on July 27th, 2012
it’s worked for me
Thanks