# Create backup from local that's importable through DevKinsta

**URL:** https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864
**Category:** Application Support
**Created:** [November 10, 2022, 7:12pm UTC](https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864 "2022-11-10T19:12:23Z")
**Posts on this page:** 6
**Page:** 1

<div class="post-metadata">

### Author: ![rpearson](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/rpearson/32/3049_2.png) [@rpearson](https://community.kinsta.com/u/rpearson)
#### Post date: [November 10, 2022, 7:12pm UTC](https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864/1 "2022-11-10T19:12:23Z")

</div>

When importing a site INTO devKinsta, it has an option to “import backup” which wants a zip file I believe.

however, there’s no option that I’m aware of to export a local site into a zip file.

On Kinsta, you can request staging and production to be compiled into a backup file which is emailed to you.

How are people doing this for local versions of code + db?

My situation is that I have an outdated version of my company’s site on my local devKinsta  
I want to be able to make a backup of my local version, then copy the production version from Kinsta into devKinsta, but be able to refer back to my original local if needed.

I cannot have a local version of production pulled down without removing my current local - due to conflicts.

Any solutions to this problem?

---

<div class="post-metadata">

### Author: ![Kevin](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/kevin/32/808_2.png) [@Kevin](https://community.kinsta.com/u/Kevin)
#### Post date: [November 10, 2022, 7:41pm UTC](https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864/2 "2022-11-10T19:41:42Z")

</div>

Hi @rpearson, thanks for reaching out. You essentially just need to create a ZIP with your file directory and a DB export.

You can use this command to create an export of your database (on a standard WP setup):

`docker exec -it devkinsta_fpm bash -c "cd /www/kinsta/public/SITENAME && wp db export --allow-root"`

You can then create a ZIP with your SQL file adjacent to your files `~/Devkinsta/public/SITENAME from your filesystem using your ZIP tool of choice.  
 ![image](https://us1.discourse-cdn.com/flex020/uploads/kinsta/original/2X/5/55953bb6d4ff92592738973a91d7db4747d7adac.png)

The process will be a bit different depending on OS but feel free to let us know if you have any questions.

---

<div class="post-metadata">

### Author: ![rpearson](https://sea2.discourse-cdn.com/flex020/user_avatar/community.kinsta.com/rpearson/32/3049_2.png) [@rpearson](https://community.kinsta.com/u/rpearson)
#### Post date: [November 10, 2022, 10:03pm UTC](https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864/3 "2022-11-10T22:03:20Z")

</div>

Thank you, looks like the db exported into a sql file properly w/ that command.

I then used Mac OS to select both .sql and the site folder and right clicked “compress” which zip’ed the site together.

Hopefully I don’t have to use it, but it’s nice knowing I should be able to import this zip into devKinsta and DevKinsta will know what to do with it (I’ve zipped just the public/sitename folder in the past, and when I tried to import via devKinsta it gave an error)

---

<div class="post-metadata">

### Author: ![sk5594](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@sk5594](https://community.kinsta.com/u/sk5594)
#### Post date: [October 25, 2024, 1:50am UTC](https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864/4 "2024-10-25T01:50:29Z")

</div>

Hi, I know this is an old post, but it worked for me once and now there’s a problem. Just today, I used the terminal command once and it made a backup with .sql extension. It put it in the same folder as the devkinsta site. I was able to make the zip file (didn’t test it with a new import yet). Anyway, the exact same terminal command never worked after the first time.

---

<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: [October 25, 2024, 3:48am UTC](https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864/5 "2024-10-25T03:48:34Z")

</div>

Hi @sk5594

Just to be sure, when running the command above, you’re updating the “SITENAME” to the actual sitename/path folder of the WordPress install, right?

For example, my Devkinsta site name is **defaultwp-1** and the WordPress install is at /www/kinsta/public/ **defaultwp-1**

So I ran this command a few times and seem it is working fine.

`docker exec -it devkinsta_fpm bash -c "cd /www/kinsta/public/defaultwp-1 && wp db export --allow-root"`

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

I can also run `cd /www/kinsta/public/defaultwp-1 && wp db export --allow-root` inside the devkinsta\_fpm container and is giving the same output.

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

---

<div class="post-metadata">

### Author: ![sk5594](https://avatars.discourse-cdn.com/v4/letter/s/eb9ed0/32.png) [@sk5594](https://community.kinsta.com/u/sk5594)
#### Post date: [October 25, 2024, 6:01pm UTC](https://community.kinsta.com/t/create-backup-from-local-thats-importable-through-devkinsta/1864/6 "2024-10-25T18:01:30Z")

</div>

Hi Adrian,  
I had already changed it to the right site name. I found out I have to start DevKinsta and Docker before running the command. That makes it output the .sql file. I can then restore using the instructions here:

> **[DevKinsta - Kinsta Integration - Kinsta® Docs](https://kinsta.com/docs/devkinsta/devkinsta-integration/#manually-import-a-backup)**
>
> Find out how you can integrate your MyKinsta sites with DevKinsta.

I do really like DevKinsta enough to try out Kinsta when my site is ready, but I would really like to see a much easier local backup solution, maybe just a backup/restore function in DevKinsta that does all this stuff for me.

Thank you for a helpful and timely response. 🙂

- Shawn
