Local Beta 5.x - Database recovery option

I had an interesting situation come up that required attempting to recover a database in a failed Local install that would not open anymore. The biggest factor here was that it was a pre Local 5.0.7 version, where Local did not export the database to a SQL file when site services were stopped. This meant that my only copy of the database was in the raw database folder in Local.

In Windows that is located here:
%AppData%\Local\run[sitehash]\mysql-raw-data

On a Mac that is:
~/Library/Application Support/Local/run/[sitehash]/mysql-raw-data

You may have a number of sites there, which will make locating which sitehash folder a little trickier.

The site-level database files are in the /local/ folder within the /mysql-raw-data/ folder. The local folder contains .ibd files but no .frm which would be required for most recovery options. From what I googled, you might be able to recover with just the .ibd files but it will be a LOT more work.

I was able to:

  1. Copy the /mysql-raw-data/ folder to another location
  2. Get Local back up and running (following the manual removal instructions and reinstalling)
  3. Create a new, blank site in local and stop the services
  4. Replace the /mysql-raw-data/ folder in the blank site
  5. Start the site up, open Adminer, export the database to a SQL file

In my tests, the OS environment is very important. I have been able to use the same method in Mac and Windows with positive results but I have not been able to move across platforms.

Good!
But do you have also a solution for the local by flywheel 3.3.0 not thebeta version?
My local machine can’t start anymore and I would like to recover my database. I don’t have the “RUN” folder.
thanks!

Local version 3.3.0 dumps the active database whenever the site services are stopped to the Local site directory > /sql/ folder. That may be missing the most recent changes but is at least a backup since the last time the site was stopped. Hopefully, that gets you up and running again.