Database connection issue

My computer froze about a half hour ago, and upon rebooting I was prompted to update Local (Lightning version). I’m always a little hesitant to update because I’ve dealt with data-loss in the past, but I did it anyway.

Oops.

Now one of the sites I was working on just refuses to connect to its database. I tried three others and they seem to be fine. I’ve tried stopping and starting a few times with no success. I also get the good old “Uh oh!” database error when stopping the site:
Uh-oh! Local ran into an issue while exporting this site's database to the site's 'app/sql' directory.

local-lightning.log (311.1 KB)

Opening the site’s shell and running wp db tables I get the same error
“Error: Error establishing a database connection.”

I was able to get into the database somehow via Adminer, after failing a couple times it just worked… I then exported the database from there and imported into a completely new project via wp cli.

Yay!

Or not, the data is at least a week old, so pretty much useless.

Moral of the story I guess is make sure you stop and start your Local sites AT LEAST daily, and probably perform a db dump a couple times a day as well since the db management within Local is… not great.

Hi Zac,

First off, I’m very sorry for the database trouble.

I appreciate all of the details and log you sent over.

It looks like when your computer froze, it caused some degree of corruption in the InnoDB data files.

You may be able to force recovery by adding innodb_force_recovery=6 beneath [mysqld] in the site’s conf/mysql/my.cnf.hbs file. After you add that, you can try restarting the site and dumping the data.


Sidenote: Here is an error message that is in the log file you provided. It’s directly from MySQL and considering you’ve run into a similar issue in the past, it might be worth looking into by using Disk Utility.app or contacting Apple.

Most likely, you have hit a bug, but this error can also be caused by malfunctioning hardware.

I totally agree. We’re currently in the research phase for a site backup of some sort.

1 Like

Thanks for the info. I already re-entered the data as it wasn’t that much I lost. But I might save a backup and try the recovery anyway just to see.

Interesting about the hardware issue. Any idea what that could be? I did run an fsck -fy after the computer froze and nothing was wrong with the ssd according to that.

Cool! That’s exciting.

Is there anyway to restore this from a backup? I have daily backups, but I tried to grab an older sql folder, and nothing has worked so far…

This topic was automatically closed 90 days after the last reply. New replies are no longer allowed.