# Purging user data from dev install

**URL:** <https://meta.discourse.org/t/purging-user-data-from-dev-install/51827>\
**Category:** Development\
**Created:** [October 21, 2016, 2:43am UTC](https://meta.discourse.org/t/purging-user-data-from-dev-install/51827 "2016-10-21T02:43:01Z")\
**Posts on this page:** 1\
**Showing post:** 2

<div class="post-metadata">

**Author:** ![neil](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/neil/32/102150_2.png) [@neil](https://meta.discourse.org/u/neil)\
**Post date:** [October 21, 2016, 7:19pm UTC](https://meta.discourse.org/t/purging-user-data-from-dev-install/51827/2 "2016-10-21T19:19:42Z")

</div>

Importing **Restoring a backup** will overwrite all data, if that’s all you need.

If you need a fresh empty database and you’re using the docker setup, you can do this:

```plaintext
./launcher enter app

# in the container as root now

sv stop unicorn

su postgres -c 'psql -c "drop database discourse"'
# or keep it: "alter database discourse rename to discourse_backup"

su postgres -c 'createdb discourse'
su postgres -c 'psql discourse -c "grant all privileges on database discourse to discourse;"'
su postgres -c 'psql discourse -c "alter schema public owner to discourse;"'
su postgres -c 'psql discourse -c "create extension if not exists hstore;"'
su postgres -c 'psql discourse -c "create extension if not exists pg_trgm;"'

RAILS_ENV=production rake db:migrate

sv start unicorn

```

---

_[View the full topic](https://meta.discourse.org/t/purging-user-data-from-dev-install/51827)._
