
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.
mariadb
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_PASSWORDis generated per deploy, and a database namedrailwayis created for you. Clients with the wrong password are refused. - Your data survives redeploys. The volume is mounted at
/var/lib/mysqland the data directory is a subdirectory of it (/var/lib/mysql/data), so thelost+foundfolder 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
utf8mb4with theutf8mb4_unicode_cicollation, 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
mariadbclient - 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
- MariaDB documentation: https://mariadb.com/kb/en/documentation/
- Official image: https://hub.docker.com/_/mariadb
Implementation Details
| Variable | Purpose |
|---|---|
MARIADB_ROOT_PASSWORD | Password of the root user, generated per deploy. |
MARIADB_PRIVATE_URL | Connection string on the private network, for services in the same project. |
MARIADB_PUBLIC_URL | Connection 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
mariadb
mariadb:11.8