# Exporting database through CLI (wp db export)

**URL:** <https://community.localwp.com/t/exporting-database-through-cli-wp-db-export/10814>\
**Category:** Support\
**Created:** [January 31, 2019, 6:33pm UTC](https://community.localwp.com/t/exporting-database-through-cli-wp-db-export/10814 "2019-01-31T18:33:03Z")\
**Posts on this page:** 3\
**Page:** 1

<div class="post-metadata">

**Author:** ![AdamCap](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/adamcap/32/6983_2.png) [@AdamCap](https://community.localwp.com/u/AdamCap)\
**Post date:** [January 31, 2019, 6:33pm UTC](https://community.localwp.com/t/exporting-database-through-cli-wp-db-export/10814/1 "2019-01-31T18:33:03Z")

</div>

I am attempting to export a site’s database through command line (for practice; I know this can be done via UIs). The steps I am taking:

1. Right-click on site \> “Open Site SSH”
2. Run command: `wp db export`

I do receive a success message:

`Success: Exported to 'local-2019-01-31-e26d535.sql'.`

But—I can’t seem to locate this file. If I right-click on the site \> “Reveal in Finder,” the .sql file isn’t placed in the `/app/public` or `/app/sql` folders, and I can’t seem to `scp` the file out of the container.

(Similarly, if I wanted to import a .sql file this way [`wp db import`], where would I place it?)

Thanks!

---

<div class="post-metadata">

**Author:** ![ben.turner](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/ben.turner/32/5366_2.png) [@ben.turner](https://community.localwp.com/u/ben.turner)\
**Post date:** [February 1, 2019, 12:14am UTC](https://community.localwp.com/t/exporting-database-through-cli-wp-db-export/10814/2 "2019-02-01T00:14:12Z")

</div>

Hey @AdamCap –

You’re pretty close. After `ssh`'ing into the site, change to the webroot, and then export the db. So something like this:

1. Right-click on site \> “Open Site SSH”
2. `cd /app/public`
3. Run command: `wp db export`

This should export it into the `public` directory within the file explorer.

The reason for this is that the `public` folder is the one that is mounted into the site container, so the workflow that you were doing was essentially writing the db dump to a location _inside_ of the container.

Hope that helps, and let me know if you have any other questions!

– Ben

---

<div class="post-metadata">

**Author:** ![system](https://sea1.discourse-cdn.com/flex019/user_avatar/community.localwp.com/system/32/1_2.png) [@system](https://community.localwp.com/u/system)\
**Post date:** [February 1, 2019, 4:51pm UTC](https://community.localwp.com/t/exporting-database-through-cli-wp-db-export/10814/3 "2019-02-01T16:51:15Z")

</div>

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