---
title: Restore SQLite database from Litestream backup
url: https://calvin.my/posts/restore-sqlite-database-from-litestream-backup
published: 2024-12-14
updated: 2026-09-17
category: Operations
tags:
- sqlite
- Database
- litestream
summary: The post explains restoring a SQLite database from a Litestream backup. On a different machine, users must install Litestream and provide configuration containing AWS S3 credentials, creating new credentials with appropriate permissions if needed. After restoring the backup to a new database location, Litestream produces database and related journal files. Users should replace corrupted database files with the restored versions and restart the application.
---

# Restore SQLite database from Litestream backup

This article is a continuation of the previous articles below:

- [https://calvin.my/posts/migrating-a-rails-app-from-mysql-to-sqlite-database](../../posts/migrating-a-rails-app-from-mysql-to-sqlite-database)
- [https://calvin.my/posts/backup-sqlite-databases-with-litestream](../../posts/backup-sqlite-databases-with-litestream)

* * *

This article shows how to restore an SQLite database from a backup using Litestream.

## Restore your backup

(If you are running from the same machine, skip steps 1 and 2.)

1. Install Litestream and copy the config file that contains the AWS S3 credentials.

2. If you lost the original S3 credentials, you can create a new one from the AWS console. Remember to give the necessary S3 permissions.

3. To restore run the following command.

   ```bash
   $ litestream restore -o /path/to/new/db.sqlite3 /path/to/db.sqlite3
   ```

4. Once the restoration is completed, you should receive one or more files, including .sqlite, .shm, and .wal

5. Delete the corrupted old database files, and replace them with these new files.

6. Restart your application.
