how to recover DB files from an image

Posted June 5, 2021 184 views

We had a server issue and had to rebuild a site from an image taken just before the crash happened. we can recover the code but the .frm files are giving error #1017. Any ideas on what we’re doing wrong?

These answers are provided by our Community. If you find them useful, show some love by clicking the heart. If you run into issues leave a comment, or add your own answer to help others.

Submit an Answer
1 answer

I’d suggest giving two things a try:

1. Check Permissions

Make sure that your MySQL data directory and all the files in it are owned by mysql user and mysql group. This may not be the case if you copied the files onto your local test machine as root user:

chown -R mysql:mysql your-mysql-data-dir-here

2. Repair corrupted tables

Use mysqlcheck to check for corrupted tables and repair them if it finds any:

mysqlcheck -u root -p --auto-repair --all-databases

If you still can’t use the tables after that then give mysqldump a go!