---
title: "Database backups"
description: "Back up databases to S3 on a schedule, and download or restore any backup."
canonical_url: "https://harblet.com/docs/backups/database-backups"
---
# Database backups

> Back up databases to S3 on a schedule, and download or restore any backup.

Harblet dumps a database and stores the file at a [backup destination](https://harblet.com/docs/backups/backup-destinations), on a schedule or when you click **Back up now**. Every backup can be downloaded and restored.

## Set up backups

<steps level="3">

### Have a destination

An admin adds a [backup destination](https://harblet.com/docs/backups/backup-destinations) first.

### Open the database

Open the database and go to its **Backups** tab.

### Choose the settings

<field-group>
<field name="Destination" :required="true">

The bucket to store the backups in.

</field>

<field name="Schedule">

**Off**, **Every 15 minutes**, **Every hour** or **Every day**. Daily backups run at 00:00 UTC.

</field>

<field name="Scheduled backups to keep">

From 1 to 100, 7 by default. Harblet deletes older scheduled backups.

</field>
</field-group>

### Save

Click **Save**. The first scheduled backup starts within a minute, then backups follow the schedule.

</steps>

Click **Back up now** to start a backup at any time. Backups you start yourself stay until you delete them. Only scheduled backups count towards **Scheduled backups to keep**.

## How scheduled backups run

- Schedules follow UTC: every 15 minutes runs at :00, :15, :30 and :45, every hour at the top of the hour, and every day at midnight. A backup starts within about a minute of its time.
- Harblet runs one backup at a time across all databases, and its own backup first.
- Scheduled backups pause while Harblet is down. When it's back, Harblet takes the backup it missed most recently, if the next one isn't due yet. Earlier missed backups are skipped.

<tip>

At worst you lose the data written since the last backup. Choose the schedule by how much data you can afford to lose.

</tip>

## The backup files

<table>
<thead>
  <tr>
    <th>
      Database
    </th>
    
    <th>
      Format
    </th>
    
    <th>
      File
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      PostgreSQL
    </td>
    
    <td>
      <code>
        pg_dump
      </code>
      
       custom format
    </td>
    
    <td>
      <code>
        .dump
      </code>
    </td>
  </tr>
  
  <tr>
    <td>
      MySQL
    </td>
    
    <td>
      <code>
        mysqldump
      </code>
      
      , gzipped
    </td>
    
    <td>
      <code>
        .sql.gz
      </code>
    </td>
  </tr>
</tbody>
</table>

Files are stored at `<folder>/<project>/<database>/<time>.<extension>` in the bucket, where project and database are their internal names, such as `shop-k3x9/postgresql-x7k2`. The **History** list shows who or what started each backup, its status, size and duration.

### Download a backup

Click the download button of a completed backup. Restore it with the usual tools:

<code-group>

```bash [PostgreSQL]
pg_restore --no-owner -d "$DATABASE_URL" postgresql-x7k2-2026-11-14T08-15-00-123Z.dump
```

```bash [MySQL]
gunzip < mysql-a9c3-2026-11-14T08-15-00-123Z.sql.gz | mysql -h 127.0.0.1 -u root -p app
```

</code-group>

## Restore a backup

Click the restore button of a completed backup and confirm. Everything written since the backup is lost.

<tabs>
<tabs-item icon="i-simple-icons-postgresql" label="PostgreSQL">

Harblet loads the backup into a new database next to the current one, then swaps it in. Open connections are closed once. If loading fails, the current database stays as it was. The connection details don't change.

</tabs-item>

<tabs-item icon="i-simple-icons-mysql" label="MySQL">

Harblet empties the database and loads the backup into it. Services that use the database see errors until the restore finishes. If loading fails, the database stays empty or partly loaded. Restore again, or restore another backup.

</tabs-item>
</tabs>

An alert above the list shows how the latest restore went.

- The database has to be running.
- A backup restores into the database it was taken from.
- Backups and restores run one at a time. While one runs, the buttons are disabled.

## Delete a backup

Click the trash button of a backup and confirm. Harblet deletes its file from the destination. This can't be undone. A failed backup has no file, so deleting it only removes it from the list.

## Errors

<table>
<thead>
  <tr>
    <th>
      Message
    </th>
    
    <th>
      What to do
    </th>
  </tr>
</thead>

<tbody>
  <tr>
    <td>
      The database isn't running.
    </td>
    
    <td>
      Deploy the database, then try again.
    </td>
  </tr>
  
  <tr>
    <td>
      A backup is running. Wait for it to finish.
    </td>
    
    <td>
      Try again when the running backup is done.
    </td>
  </tr>
  
  <tr>
    <td>
      Harblet restarted during the backup.
    </td>
    
    <td>
      Start the backup again.
    </td>
  </tr>
  
  <tr>
    <td>
      A restore is running. Wait for it to finish.
    </td>
    
    <td>
      Try again when the restore is done.
    </td>
  </tr>
  
  <tr>
    <td>
      Harblet restarted during the restore.
    </td>
    
    <td>
      Restore the backup again.
    </td>
  </tr>
  
  <tr>
    <td>
      Wait for the backup to finish before deleting it.
    </td>
    
    <td>
      Delete the backup once it's done.
    </td>
  </tr>
  
  <tr>
    <td>
      Wait for the restore to finish before deleting this backup.
    </td>
    
    <td>
      Delete the backup once the restore is done.
    </td>
  </tr>
  
  <tr>
    <td>
      This destination was removed. Choose another one.
    </td>
    
    <td>
      Choose another destination and click <strong>
        Save
      </strong>
      
      .
    </td>
  </tr>
</tbody>
</table>


## Sitemap

See the full [sitemap](https://harblet.com/sitemap.md) for all pages.
