Error establishing a database connection 2022

Q: Date/Time this occurred (Provide your time zone also)
A: Discovered this on 10 Nov 2022. Singapore time.

Q: DevKinsta Version
A: 2.8.0

Q: OS Version
A: Windows 10 Home

Q: Docker Desktop Version
A: 4.13.1

Q: Were any error codes or messages observed? If so, what were they?
A: “Error establishing a database connection”

Q: Detailed Description of the Problem
A: I tried to access my site today, having last assessed it on 29 Sept 2022.

(a) When I clicked on “Open Site”, the website showed “Error establishing a database connection”

(b) When I clicked on “Open WP Admin”, the website showed “Cannot select database”.

The database server could be connected to but the Jack_Sheo database cannot be selected.

(c) When I clicked on “Open database manager”, the website showed a bunch of error messages. See screenshot.

It seems my Jack_Sheo database has suddenly disappeared.

It is worrying as I don’t have any other backup.

How can I fix this pls? Appreciate your input pls.

P.S. I had looked through the forum and it seems this sudden database disappearance has happened to others as well. I’ve gone into Docker to look at the Resources settings but it says the resource limits are managed by Windows as I’m using WSL 2 backend.



Hi @jacksheo, thanks for reporting this. Looking at when Docker 4.13.1 came out vs the last time you accessed your site, my best guess is that it has something to do with a docker update.

Can you please open your filemanager and screenshot what you see at these two addresses:

\\wsl$\docker-desktop-data\data\docker\volumes

\\wsl$\docker-desktop-data\data\docker\volumes\devkinsta_db_data\_data

For example:

It’ll be useful if we can see the modify dates for your folders

Hi Kevin

  1. Please advise how I can locate these 2 locations on my windows pc.

My folders have been set to show hidden files, folders & drives.

Couldn’t find anything like your screenshot when I searched “docker-desktop-data” or “devkinsta_db_data”.

  1. Separately, I went into Docker Engine app and saw something remotely similar to the two addresses above. Please see the screenshots below:

Hi @jacksheo, you need to actually navigate to those paths using your address bar:
image

I don’t think you can normally navigate to it but I can see it under Quick Access > Network
image

No go. This is what I get after entering the path into my address bar.

Oh, I managed to find this:

Wow, that’s odd, you genuinely don’t have a data folder there. I wonder where your data is being stored. Can you go up one directory? What do you have here:
image

I think I just found what you wanted. No Jack-Sheo folder anymore

Why is “Jack Sheo” listed as a custom site?

“183 MB” is shown. Is that a good sign?

“test site” is gone too

What is the actual path for this screenshot if it’s not here: \\wsl$\docker-desktop-data\data

I can see test2’s database was last modified in September so if something deleted all the the db data, it doesn’t make sense for that single DB to still be there.

Can you also try going to the top \\wsl$ folder and just run a search for “jack?” This will help to rule out the db actually being hidden in there.

  1. This is the full path:

\wsl$\docker-desktop-data\version-pack-data\community\docker\volumes\devkinsta_db_data_data

  1. test2 was created when I was trying to troubleshoot the “site greyed out” issue that you were helping me with.

Can’t find any results for “jack” in the top \wsl$ folder …

Sorry, can only find “jack-sheo.local.json”

That’s weird, I’ve always had that path for the Docker volumes. Your path seems to be for the old version of Docker:

It might be because you are on Windows Home edition, but I’m not 100% sure.

How far back do your logs here go?

Do you only see entries from November? This just doesn’t make any sense to me because no action from DevKinsta would do this. A stretch would be an Antivirus program quarantine on your system but I don’t know if that’s possible.

So I’ll ask our Devs if they have any addition ideas. Please take a screenshot of \\wsl$\ so we can see everything there.

Also just to confirm, between being able to access your site on Sept 29 and not having a DB now, the only change on your system was the Docker update, correct? Was it an automatic update or did you manually tell Docker to update? I think that depends on your setting here:

  1. The logs start from 27 Sep 2022. That’s the day when I last reached out to you about the sites turning grey again. Managed to access the site on 29 Sep 2022.

  1. This is the screenshot of \wsl$\

  1. My Docker Desktop is set to automatic update

Even that looks a little different from what I have:

Can you please copy those log entries to a txt file then share it as well?
image

I’ll ask our developers for their input but for now please disable the automatic updates in Docker. I’m not sure if that caused it but it’s best to just disable them to be sure.

Log file attached.

devkinsta_db log.txt (241.4 KB)

I won’t be doing anything on devkinsta for now until I know for sure whether I can get my database back.

I only have one project, which is the one lost. Unfortunately, I don’t have any backup and the bulk of the work was done many many months back before I first had the greyed-out issue.

Two questions:

  1. I noticed that the devkinsta page shows the site using 183mb. Does this mean the data is somewhere?

  2. Why does devkinsta list the site as a custom site?

Thanks for sharing that @jacksheo. I honestly understand the apprehension here since we don’t know exactly why the database disappeared. We are working on an automated backup system built-into DevKinsta which will cover situations like these. You could also use an incremental backup plugin while developing to make sure there’s always a copy of your DB among your sitefiles.

  1. This is counting files & database. You might have an old backup.sql file in your site root. DevKinsta used to leave those there after pushing/pulling the site. If you do have a backup.sql, it won’t be your most recent database but you can still try to import it to be sure (I can help you with this if needed).
  2. The function DevKinsta uses just checks for a valid WP install. Since your WP install is returning a database error, DevKinsta is treating it as a custom site.

The only action within DevKinsta that modifies that database is “Deleting a site.” If your main.log/main.log.old go back far enough, we can see each action that DevKinsta ran but that wouldn’t be helpful in restoring the database. There are system-level things that could cause data-loss as well like OS updates and antiviruses. It’s really odd though that you seem to have issues with DevKinsta every time you leave it for more than a month.

Hey Kevin, pls let me know where I can find this backup.sql

And how to go about restoring if I can find it.

Thanks!