DevKinsta Error Establishing a Database Connection

Hi,

I am trying to create a local version of my live site using DevKinsta - I had a clean local site previously that I was building but I pushed it to the staging environment for one of my sites in order to back it up as I was not able to use the computer anymore.

What I have done, yesterday, was pull the site from the staging into the local DevKinsta environment - Docker not running in WSL mode as a group policy was not allowing me to do so - and I haven’t been able to get the site to work, keep getting the ‘error establishing a database connection’ error. I have tried multiple times to download the site and I have also tried renaming it to the original local name hoping that would work.

I have also tried following the steps shared here to no avail but now I don’t have the db anymore either (I was not able to successfully import the backup.sql)

Hello @thatguycleeeb :waving_hand: Welcome to Kinsta community!

Does the site work on Staging site at Kinsta?

Yes it does - staging loads, although some pictures are missing but I know that that is because they point to a local path on the old computer

Great :+1:

That means this is probably solvable.

There was a bug that created issues in wp-config.php which might be a part of the problem. Can you please access wp-config on the site localy and check that domain_current_site variable is set to correct local domain (it might show as undefined)?

Also, feel free to DM me the name of the staging site on Kinsta so I can check it.

Thank you Vladimir, I have double checked. The variable is set to the local site. Just did a redownload of the staging site to see if that would help but it didn’t.

Edit: the DB, in DevKinsta, says that it is 0B. Not sure if the problem lies there? The backup db is about 30MB but when I had previously tried to import it I kept getting the same error - the one in the original post.

Thank you for your reply!

Let’s try this:

  • open adminer from DevKinsta
  • select the site’s database and empty it/drop all tables
  • while the database is selected, try import then

If it fails again, please send me in private message/DM either the name of the staging site, or the sql file so I can test on my end. Also, please attach the main.log of DevKinsta so I can see if there are any errors pertaining to the current issue.

Here’s how to get the DevKinsta main.log: Troubleshooting - Error Codes - Kinsta® Docs

I’m still struggling with this.

Please see the prefixes below


image

The table prefix in wp-config was wp_ I changed it to wp_4_ - both don’t work though

@thatguycleeb

I am not sure if this has been tried, but can you try creating a downloadable backup of your Kinsta staging site and importing the backup file to DevKinsta under the Add new site >> Custom Site >> Import backup Option?

Thank you Adrian. I have tried this twice and had the same result.

The wp-config also looks like this

Hello @thatguycleeb :waving_hand:

Can you please send me the wp-config.php in private/DM?

Sending the update here as well:

Hello @thatguycleeb :waving_hand:

While this is completely out of scope of our services I have tried composing a backup like the one from Mykinsta but I was not successful.

I was able to get the site working on my end by manually correcting issues.

  1. Take wp-config-sample.php, copy the code out of it and replace the database name, user, host and password. host should be devkinsta_db, the user is root, the password you can get from DevKinsta site page, it should contain. You will also need to update the DOMAIN_CURRENT_SITE to foundation.local
  2. You then need to edit wp_blogs, wp_options, wp_4_options to edit site URLs in all of them.

I know it’s a lot of work that DevKinsta should handle automatically, but for some reason the backup simply doesn’t work. I’ve tried many options, unpacking it and fixing it myself but for some reason it won’t upload/unpack properly in DevKinsta.

I’m sorry I wasn’t able to provide a better solution.

Hi Vladimir,

Just wanted to let you know that I got it to work. Tried your suggestion but didn’t win with that.
What ended up working was creating the site from Kinsta as before, then in the DevKinsta ‘admin console’ I synced it with the Kinsta site and that seemed to fix it so I am now able to get into the site and do everything that is needed.

Thank you for your assistance.

1 Like

Hello @thatguycleeeb :waving_hand: I’m sorry the steps I gave you didn’t provide help, but I’m glad to hear you got it working in the end. :tada: