Deploy MariaDB | (Just Updated) Official 11.8 LTS, Root Password Set, Data Survives Redeploys

Official MariaDB 11.8 LTS. Root password set, data survives redeploys.

Deploy MariaDB | (Just Updated) Official 11.8 LTS, Root Password Set, Data Survives Redeploys

Just deployed

/var/lib/mysql

Deploy and Host MariaDB on Railway

MariaDB is the open-source MySQL-compatible relational database behind WordPress, Nextcloud, Matomo and a long list of PHP and Python applications. This template runs the official MariaDB 11.8 LTS image as a single service from a digest-pinned image, with the database port on a Railway TCP proxy and a Railway volume holding the data files.

About Hosting MariaDB

  • A root password is set from the first boot. MARIADB_ROOT_PASSWORD is generated per deploy, and a database named railway is created for you. Clients with the wrong password are refused.
  • Your data survives redeploys. The volume is mounted at /var/lib/mysql and the data directory is a subdirectory of it (/var/lib/mysql/data), so the lost+found folder Railway puts at the volume root never lands inside the data directory. The start command runs the server as root so the root-owned volume is writable, and prints the user id and mount owner in the deploy log so you can confirm it.
  • Buffer pool follows your plan. The InnoDB buffer pool is set from the container's memory limit (half of it), not from the host's RAM, so the server does not size itself for a machine it cannot use.
  • utf8mb4 by default. The server character set is utf8mb4 with the utf8mb4_unicode_ci collation, so emoji and non-Latin text store correctly.
  • Two ways in. Services in the same project use the private URL; clients elsewhere use the TCP proxy URL.

Common Use Cases

  • The database for a WordPress, Nextcloud, Matomo or Ghost deployment
  • The primary store for a PHP, Python, Node.js or Go application
  • A development or staging database you can reach from your laptop with the mariadb client
  • A drop-in replacement for a MySQL service when you want a fully open-source server

Dependencies for MariaDB Hosting

  • One Railway volume for the data directory (created by the template)

Deployment Dependencies

Implementation Details

VariablePurpose
MARIADB_ROOT_PASSWORDPassword of the root user, generated per deploy.
MARIADB_PRIVATE_URLConnection string on the private network, for services in the same project.
MARIADB_PUBLIC_URLConnection string on the TCP proxy, for clients outside Railway.

Connect from your machine:

mariadb --host= --port= -uroot -p railway

Why Deploy MariaDB 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 MariaDB 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.


Template Content

More templates in this category

View Template
NEW
TimescaleDB
A PostgreSQL-based time-series database for analytics on Railway.

Rakit
1
View Template
Garage S3 Storage
Ultra-light S3 server: fast, open-source, plug-and-play.

PROJETOS
8
View Template
Redis
Self Host Latest Redis with Railway

9