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

# Deploy MySQL PITR

Point-in-time recovery via binlog archiving for MySQL, standalone or HA

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

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/mysql-pitr/manifest.json

## 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 MySQL service on Railway: a service from the MySQL template (enabling PITR moves it onto Railway's MySQL image at the same version) or a MySQL HA cluster (enabling from the cluster's Backups tab rolls through the members without disrupting quorum; the current primary archives).
- **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.


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