# DevKinsta Error Establishing a Database Connection

**URL:** https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067
**Category:** Questions
**Created:** [May 14, 2025, 7:46am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067 "2025-05-14T07:46:34Z")
**Posts on this page:** 13
**Page:** 1

<div class="post-metadata">

### Author: ![thatguycleeeb](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/thatguycleeeb/32/4712_2.png) [@thatguycleeeb](https://community.kinsta.com/u/thatguycleeeb)
#### Post date: [May 14, 2025, 7:46am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/1 "2025-05-14T07:46:34Z")

</div>

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](https://community.kinsta.com/t/creating-new-site/1408/49) to no avail but now I don’t have the db anymore either (I was not able to successfully import the backup.sql)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/7/767496d7bd3741a67fe148050d1fb5b3c060e1a4.png)

---

<div class="post-metadata">

### Author: ![VladimirM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/vladimirm/32/2786_2.png) [@VladimirM](https://community.kinsta.com/u/VladimirM)
#### Post date: [May 14, 2025, 8:48am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/2 "2025-05-14T08:48:23Z")

</div>

Hello @thatguycleeeb 👋 Welcome to Kinsta community!

Does the site work on Staging site at Kinsta?

---

<div class="post-metadata">

### Author: ![thatguycleeb](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@thatguycleeb](https://community.kinsta.com/u/thatguycleeb)
#### Post date: [May 14, 2025, 9:00am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/3 "2025-05-14T09:00:18Z")

</div>

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

---

<div class="post-metadata">

### Author: ![VladimirM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/vladimirm/32/2786_2.png) [@VladimirM](https://community.kinsta.com/u/VladimirM)
#### Post date: [May 14, 2025, 9:13am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/4 "2025-05-14T09:13:30Z")

</div>

Great 👍

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.

---

<div class="post-metadata">

### Author: ![thatguycleeb](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@thatguycleeb](https://community.kinsta.com/u/thatguycleeb)
#### Post date: [May 14, 2025, 10:39am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/5 "2025-05-14T10:39:59Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![VladimirM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/vladimirm/32/2786_2.png) [@VladimirM](https://community.kinsta.com/u/VladimirM)
#### Post date: [May 14, 2025, 11:05am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/6 "2025-05-14T11:05:40Z")

</div>

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](https://kinsta.com/docs/devkinsta/devkinsta-troubleshooting/error-codes/#viewing-the-application-log-file)

---

<div class="post-metadata">

### Author: ![thatguycleeb](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@thatguycleeb](https://community.kinsta.com/u/thatguycleeb)
#### Post date: [May 14, 2025, 6:34pm UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/8 "2025-05-14T18:34:02Z")

</div>

I’m still struggling with this.

Please see the prefixes below

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/2/2d639e2d2d190fd94a6673bff75d31b6f0ba2d99.png)  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/8/8cc489b191bef6e87a721a0c8652eac7e5d3a970.png)

The table prefix in wp-config was wp\_ I changed it to wp\_4\_ - both don’t work though

---

<div class="post-metadata">

### Author: ![Adrian\_L](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/adrian_l/32/2810_2.png) [@Adrian\_L](https://community.kinsta.com/u/Adrian_L)
#### Post date: [May 15, 2025, 5:54am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/9 "2025-05-15T05:54:29Z")

</div>

@thatguycleeb

I am not sure if this has been tried, but can you try creating a [downloadable backup](https://kinsta.com/changelog/downloadable-backups/) of your Kinsta staging site and importing the backup file to DevKinsta under the Add new site \>\> Custom Site \>\> Import backup Option?

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/f/f172b6cb6ddccde5878ef822be8ec4f1d236e2a2.png)

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/e/e6b7b7d7e0adbc7089577d0e15dae88e2c2f16bb.png)

---

<div class="post-metadata">

### Author: ![thatguycleeb](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@thatguycleeb](https://community.kinsta.com/u/thatguycleeb)
#### Post date: [May 15, 2025, 8:58am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/10 "2025-05-15T08:58:17Z")

</div>

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

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/6/60e482da918738f11e5ffa51afd52757ba313b01.jpeg)

The wp-config also looks like this

 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/4/46ad27f5b0c08489c6c367da8e0c602cce46f26f.png)

---

<div class="post-metadata">

### Author: ![VladimirM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/vladimirm/32/2786_2.png) [@VladimirM](https://community.kinsta.com/u/VladimirM)
#### Post date: [May 15, 2025, 10:28am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/11 "2025-05-15T10:28:21Z")

</div>

Hello @thatguycleeb 👋

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

---

<div class="post-metadata">

### Author: ![VladimirM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/vladimirm/32/2786_2.png) [@VladimirM](https://community.kinsta.com/u/VladimirM)
#### Post date: [May 15, 2025, 2:40pm UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/12 "2025-05-15T14:40:00Z")

</div>

Sending the update here as well:

Hello @thatguycleeb 👋

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.

---

<div class="post-metadata">

### Author: ![thatguycleeb](https://avatars.discourse-cdn.com/v4/letter/t/e99b99/32.png) [@thatguycleeb](https://community.kinsta.com/u/thatguycleeb)
#### Post date: [May 18, 2025, 8:55am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/13 "2025-05-18T08:55:15Z")

</div>

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.

---

<div class="post-metadata">

### Author: ![VladimirM](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/vladimirm/32/2786_2.png) [@VladimirM](https://community.kinsta.com/u/VladimirM)
#### Post date: [May 19, 2025, 6:14am UTC](https://community.kinsta.com/t/devkinsta-error-establishing-a-database-connection/5067/14 "2025-05-19T06:14:25Z")

</div>

Hello @thatguycleeeb 👋 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. 🎉
