Using perror to explain mysql error codes


A customer came to us with a problem copying one database to another, and requested we do it for him.  Once we logged in we saw the error fairly quickly

~# mysqldump -uadmin -p`cat /root/.mysqlpass` database >dbdump.sql
mysqldump: Got error: 29: File ‘./database/tablename.MYD’ not found (Errcode: 24) when using LOCK TABLES
~#

It can be fairly easy to work out what the error message means using something called perror

~# perror 24
OS error code 24: Too many open files
~#

Once you know the error, you can add the work around that fixes it. In this case make it do a single transaction to dump the large database.

~# mysqldump –single-transaction -uadmin -p`cat /root/.mysqlpass` database >dbdump.sql
~#

If you ever have a problem similar, and need a hand with that, just let us know.