# Accessing Database while discourse not running

**URL:** https://meta.discourse.org/t/accessing-database-while-discourse-not-running/362626
**Category:** Development
**Created:** [April 19, 2025, 4:33pm UTC](https://meta.discourse.org/t/accessing-database-while-discourse-not-running/362626 "2025-04-19T16:33:21Z")
**Posts on this page:** 1
**Page:** 1

<div class="post-metadata">

### Author: ![Alexander\_Wright](https://sea3.discourse-cdn.com/meta/user_avatar/meta.discourse.org/alexander_wright/32/119518_2.png) [@Alexander\_Wright](https://meta.discourse.org/u/Alexander_Wright)
#### Post date: [April 19, 2025, 4:33pm UTC](https://meta.discourse.org/t/accessing-database-while-discourse-not-running/362626/1 "2025-04-19T16:33:21Z")

</div>

# _ **Danger!!** _

This may well break your installation, but it may get you out of a hole.  
Use these instructions with great care.

If you can’t get the discourse container to run with `./launcher rebuild app` for any reason and need to access the database to resolve the problem, do try these instructions.

The technique uses a Docker image of Postgres to access the volume of your installed Discourse. Do not run this while Discourse is running!

This assumes that discourse is installed in /var/discourse, and that you know how to operate Postgres via the command line.

**Change ‘mysecretpassword’ to a more secure value.**

```plaintext
# Pull the correct image for your version of Discourse.
docker pull postgres:15
        
# Start the container and direct it to the local database files.
docker run --name postgres_container -e POSTGRES_PASSWORD=mysecretpassword -d -p 5432:5432 -v /var/discourse/shared/standalone/postgres_data:/var/lib/postgresql/data postgres:15
        
 # Enter the container
 docker exec -it postgres_container /bin/bash
        
 # Once in the container:
 su postgres
        
 # run the db client
 psql
        
 # Trash the database as you see fit.

# When finished:
docker stop postgres_container
docker rm postgres_container
docker rmi postgres:15

```

You may need to restart docker before attempting to restart discourse.

```plaintext
service restart docker.

```
