---
title: "Deploy MySQL PITR"
description: "Point-in-time recovery via continuous binlog archiving for standalone MySQL"
category: "Storage"
url: https://railway.com/deploy/mysql-pitr
---

# Deploy MySQL PITR

Point-in-time recovery via continuous binlog archiving for standalone MySQL

**[Deploy MySQL PITR on Railway](https://railway.com/template/mysql-pitr)**

- **Category:** Storage

## Template content

### MySQL https://devicons.railway.app/i/mysql.svg

- **Image:** ghcr.io/railwayapp-templates/mysql-ha/mysql:8.4

## Buckets

- **MySQL-PITR**

## Documentation

# Deploy and Host MySQL PITR on Railway

MySQL with point-in-time recovery powered by continuous binary log archiving. Every committed transaction is shipped to a Railway Bucket, letting you restore your database to any specific timestamp within your retention window.

## About Hosting MySQL PITR

Hosting MySQL PITR on Railway provisions a Railway Bucket alongside your existing MySQL service and streams binary logs to it continuously, on top of periodic full backups. The archiver ships in Railway's MySQL image and activates automatically when `BINLOG_ARCHIVE_BUCKET` is detected on startup — no manual installation or configuration needed. Railway's Backups panel handles the full restore workflow: pick a target timestamp, and Railway provisions a new service, restores the newest full backup before your target, and replays binlogs forward to it.

## Common Use Cases

- Recovering from accidental `DROP TABLE`, `DELETE`, or row-level data corruption
- Rolling back a failed migration to a known-good state before changes were applied
- Meeting compliance or audit requirements for point-in-time data recoverability
- Creating a safety net before major schema changes or MySQL version upgrades

## Dependencies for MySQL PITR Hosting

- **MySQL** — A running Railway MySQL service (standalone) on Railway's MySQL image. HA clusters require a dedicated rolling flow to enable PITR without disrupting quorum.
- **Railway Bucket** — Provisioned automatically by this template; stores binary logs and full backups.

### Deployment Dependencies

- [MySQL binary log documentation](https://dev.mysql.com/doc/refman/en/binary-log.html)
- [Railway Buckets documentation](https://docs.railway.com/reference/buckets)
- [Railway Volumes documentation](https://docs.railway.com/reference/volumes)

### Implementation Details

This template overlays six `BINLOG_ARCHIVE_*` environment variables onto your existing MySQL service. The image detects `BINLOG_ARCHIVE_BUCKET` on startup, enables binary logging with archiving-safe retention, takes a full backup, and begins shipping binlogs continuously. To restore, select a target timestamp in the Backups panel — Railway creates a new service whose first boot restores the newest full backup at or before the target and replays binary logs forward to it.

## Why Deploy MySQL PITR on Railway?

Railway is a singular platform to deploy your infrastructure stack. Railway will host your infrastructure so you don't have to deal with configuration, while allowing you to vertically and horizontally scale it.

By deploying MySQL PITR on Railway, you are one step closer to supporting a complete full-stack application with minimal burden. Host your servers, databases, AI agents, and more on Railway.


## Similar templates

- [Garage S3 Storage](https://railway.com/deploy/garage-s3-storage) — Ultra-light S3 server: fast, open-source, plug-and-play.
- [Redis](https://railway.com/deploy/redis-1) — Self Host Latest Redis with Railway
- [EasyImg](https://railway.com/deploy/easyimg) — Simple self-hostable Nuxt.js personal image hosting system.

Open this page in a browser: https://railway.com/deploy/mysql-pitr
