Railway

Deploy MySQL 8 or Any Version

Choose tag MySQL version and deploy - default 8.0.35

Deploy MySQL 8 or Any Version

/var/lib/mysql

Deploy and Host

Deploy this repository as a new service on Railway. The service runs MySQL in a container and persists data to a volume. Configure MYSQL_ROOT_PASSWORD (required) and optionally MYSQL_VERSION and MYSQL_DATABASE in the service variables.

About Hosting

This template is hosted as a Docker-based service on Railway. MySQL runs from the official Docker image; the version is chosen via the MYSQL_VERSION build variable. Data is stored in a volume mounted at /var/lib/mysql. Use Railway’s TCP Proxy if you need to connect from outside Railway.

Why Deploy

  • Choose your MySQL version – Set MYSQL_VERSION (e.g. 8.0.35, 8.0.40, 5.7) instead of being locked to a single version.
  • Simple setup – Set MYSQL_ROOT_PASSWORD and optionally the database name; no extra config required.
  • Persistent data – Attach a volume at /var/lib/mysql so data survives redeploys.
  • General-purpose config – utf8mb4 and a strict sql_mode suitable for most applications.

Common Use Cases

  • Backend database for web apps (Node, PHP, Python, etc.)
  • Development or staging MySQL when you need a specific version (e.g. 8.0 for Magento 2.4)
  • Any project that needs MySQL with a configurable version on Railway

Dependencies for

This template provides a MySQL server. Your application (or other services) depend on it for database storage.

Deployment Dependencies

  • MYSQL_ROOT_PASSWORD (required) – Root password for MySQL. Set this in the service variables before or at deploy; the container will not start without it.
  • Volume – Add a volume mounted at /var/lib/mysql for persistent data. Without it, data is lost on redeploy.
  • MYSQL_VERSION (optional) – Docker image tag (e.g. 8.0.35, 5.7). Default: 8.0.35.
  • MYSQL_DATABASE (optional) – Database name created on first run. Default: railway.

Template Content

More templates in this category

View Template
Postgres Backup to Cloudflare R2 (S3-Compatible)
Automated PostgreSQL backups to S3-compatible storage with encryption

Aman
View Template
ReadySet
A lightweight caching engine for Postgres

Milo
View Template
Simple S3
Deploy a S3-compatible storage service with a pre-named bucket.

Joey Chilson