2 Notes:

  • This is for a Windows installation.
  • I'm stupid.

In the process of cleaning up some stuff that was entirely unrelated, I accidentally deleted the directory /mysql/data/[database], with all the .frm and .idb files.

Move ahead a few hours, when I tried to utilize that database and it didn't work. I couldn't figure it out, so I ended up going into mySQL Workbench and dropping the table from there.

I then realized what I had done, so I went into recycle bin, got the files I had deleted, and recreated the physical directory at /mysql/data/[database] and pasted the files there, then reloaded MySQL Workbench - I hit refresh, and I saw the database there, but I can't access anything - it says the tables are all empty.

The good thing is that I have an .sql file of the database that I generated earlier today - I've tried importing it through MySQL workbench and I get the "table doesn't exist" error.

The entire installation contains about 9 different databases for 9 different projects - only this 1 was affected.

What's the best way to go about fixing this? Since I have a valid .sql file containing this database, I'm more than happy to export the other 8 databases and then completely re-create the installation using these .sql files - I've just never done that and I'm not sure how to go about it.

If there's an easier way, I'll take that first. :)

  • 1
    Stopping MySQL and restarting should resolve it. InnoDB will re-read the table information and you should be able to access. I have done this a few times myself. If the process will not stop normally, kill it and InnoDB will start a crash recovery. – Gmck Nov 20 '15 at 19:03
  • 2
    Do the .sql files contain both the structure and data? – akuzminsky Nov 20 '15 at 19:06
  • 1
    Then I would DROP [database] and reload it from the dumps. – akuzminsky Nov 20 '15 at 19:09
  • 1
    @BrianPowell, can you create the missing table manually in the affected db from the workbench? Just create it and leave it empty and then try to import the db from .sql file. – Diamant Nov 20 '15 at 19:10
  • 1
    41 means Directory not empty remove all files from ltc first. – akuzminsky Nov 20 '15 at 19:12

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.