---
title: "Deploy phpMyAdmin 5.2 with MySQL 8.4 LTS"
description: "MySQL web admin with its own login, plus a ready MySQL 8.4 LTS database."
category: "Storage"
url: https://railway.com/deploy/phpmyadmin-52-with-mysql-84-lts
---

# Deploy phpMyAdmin 5.2 with MySQL 8.4 LTS

MySQL web admin with its own login, plus a ready MySQL 8.4 LTS database.

**[Deploy phpMyAdmin 5.2 with MySQL 8.4 LTS on Railway](https://railway.com/template/phpmyadmin-52-with-mysql-84-lts)**

Machine-readable deploy manifest (JSON, validated by TemplateCI): https://railway.com/deploy/phpmyadmin-52-with-mysql-84-lts/manifest.json

- **Creator:** Tracklayer
- **Category:** Storage
- **Total deploys:** 1

## Template content

### phpMyAdmin https://cdn.jsdelivr.net/gh/homarr-labs/dashboard-icons/svg/phpmyadmin.svg

- **Image:** phpmyadmin:5.2.3-apache@sha256:1195ef91dedae0429dd8c1ae3e7e438ce83356f4bb03b8a03e6934f5a8c1a006
- **Start command:** `/bin/bash -c 'set -e; n() { case "$1" in ""|*[!0-9]*) echo $2 ;; *) echo $1 ;; esac; }; E=/etc/apache2/mods-enabled; N=$(ls $E/mpm_*.load 2>/dev/null | wc -l | tr -d " "); if [ "$N" -ne 1 ] || [ ! -e $E/mpm_prefork.load ]; then echo "pma-start: $N Apache MPM modules enabled, keeping mpm_prefork only"; rm -f $E/mpm_*.load $E/mpm_*.conf; a2enmod -q mpm_prefork; fi; W=$(n "$PMA_APACHE_WORKERS" 10); if [ $W -lt 2 ]; then W=2; fi; if [ $W -gt 256 ]; then W=256; fi; A=/etc/apache2/conf-enabled/zz-railway.conf; echo "ServerName localhost" > $A; echo "ServerTokens Prod" >> $A; echo "ServerSignature Off" >> $A; echo "<IfModule mpm_prefork_module>" >> $A; echo "StartServers 2" >> $A; echo "MinSpareServers 1" >> $A; echo "MaxSpareServers 4" >> $A; echo "ServerLimit $W" >> $A; echo "MaxRequestWorkers $W" >> $A; echo "MaxConnectionsPerChild 500" >> $A; echo "</IfModule>" >> $A; I="${PHP_INI_DIR:-/usr/local/etc/php}/conf.d/zz-railway.ini"; echo "display_errors = Off" > $I; echo "log_errors = On" >> $I; echo "expose_php = Off" >> $I; echo "pma-start: Apache prefork MaxRequestWorkers $W, PMA_HOST ${PMA_HOST:-unset}:${PMA_PORT:-3306}, root login ${PMA_ALLOW_ROOT:-false}"; exec /docker-entrypoint.sh apache2-foreground' pma-start`
- **Health check:** /
- **Public domain:** Yes

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

- **Image:** mysql:8.4.13@sha256:8c233bad33d520a7aae1c1e619c3a9775f4a1ba2d463d692fada04ec7f40be00
- **Start command:** `/bin/bash -c 'set -e; k() { v=$1; if [ $v -lt $2 ]; then v=$2; fi; if [ $v -gt $3 ]; then v=$3; fi; echo $v; }; n() { case "$1" in ""|*[!0-9]*) echo $2 ;; *) echo $1 ;; esac; }; H=$(( $(n "$(grep -m 1 MemTotal /proc/meminfo | tr -s " " | cut -d " " -f 2)" 1048576) / 1024 )); L=$(cat /sys/fs/cgroup/memory.max 2>/dev/null || cat /sys/fs/cgroup/memory/memory.limit_in_bytes 2>/dev/null || echo max); M=$(( $(n "$L" $((H * 1048576))) / 1048576 )); if [ $M -gt $H ]; then M=$H; fi; B=$(k $(n "$MYSQL_MEMORY_LIMIT_MB" $(k $M 256 8192)) 256 4194304); P=$(k $(n "$MYSQL_BUFFER_POOL_MB" $(k $((B / 2)) 128 2097152)) 32 4194304); C=$(k $(n "$MYSQL_MAX_CONNECTIONS" $(k $((B / 8)) 100 500)) 10 100000); echo "mysql-start: budget ${B}MB (container ${M}MB, host ${H}MB), innodb_buffer_pool_size ${P}M, max_connections $C"; set -f; X="${MYSQL_EXTRA_ARGS:-}"; if [ -n "$X" ] && ! mysqld --user=mysql --validate-config $X > /tmp/mysql-validate.log 2>&1; then echo "mysql-start: WARNING MYSQL_EXTRA_ARGS rejected by mysqld --validate-config, starting without it: $(grep -m 1 ERROR /tmp/mysql-validate.log)"; X=""; fi; exec docker-entrypoint.sh mysqld --innodb-use-native-aio=0 --disable-log-bin --performance-schema=0 --innodb-buffer-pool-size=${P}M --max-connections=$C --character-set-server=utf8mb4 --collation-server=utf8mb4_0900_ai_ci --max-allowed-packet=64M $X' mysql-start`

## Documentation

# Deploy and Host phpMyAdmin with Railway

phpMyAdmin is the classic web interface for MySQL and MariaDB. This template deploys phpMyAdmin 5.2 with cookie login, connected over Railway's private network to a bundled MySQL 8.4 LTS database, so you can create tables, run SQL and import dumps from your browser minutes after deploying. It can manage any existing Railway MySQL or MariaDB too.

## About Hosting phpMyAdmin

phpMyAdmin is a PHP application served by Apache. It stores no data of its own: every login is a MySQL account, checked by the database server (cookie authentication). Hosting it means running the web service with sensible PHP limits for imports, pointing it at a database host, and making sure it never becomes an open door to your network. This template pins phpMyAdmin and MySQL to exact image digests, keeps MySQL private (no public port), disables the free-text server field and password-less logins, blocks root logins by default, logs failed logins, and sizes MySQL's InnoDB buffer pool from the container's memory limit instead of a fixed 1 GB.

## Common Use Cases

- Browse, search and edit rows of a Railway MySQL or MariaDB database
- Import `.sql` dumps (up to 64 MB by default) and export tables or whole databases
- Create tables, indexes, views and users with a visual editor
- Run ad-hoc SQL and inspect query plans
- Give a teammate a database login without installing a desktop client

## Dependencies for phpMyAdmin Hosting

- phpMyAdmin web application (`phpmyadmin` official image, Apache variant)
- A MySQL or MariaDB server to manage (bundled: MySQL 8.4 LTS)

### Deployment Dependencies

- phpMyAdmin documentation: https://docs.phpmyadmin.net/en/latest/
- phpMyAdmin Docker image: https://hub.docker.com/_/phpmyadmin
- MySQL 8.4 reference manual: https://dev.mysql.com/doc/refman/8.4/en/
- Railway private networking: https://docs.railway.com/guides/private-networking

### Implementation Details

| Service | Image | Purpose | Public |
|---|---|---|---|
| phpMyAdmin | `phpmyadmin:5.2.3-apache` (digest-pinned) | Web UI on port 80, cookie login | HTTPS domain |
| MySQL | `mysql:8.4.13` (digest-pinned, LTS) | Database, volume `/var/lib/mysql` | No (private network only) |

**First login**

1. Open the MySQL service → Variables and copy `MYSQL_USER` (default `railway`) and `MYSQL_PASSWORD`.
2. Open the phpMyAdmin public domain and log in with them. The `railway` database is ready.
3. For server-wide work (creating databases or users), set `PMA_ALLOW_ROOT=true` on phpMyAdmin, redeploy, and log in as `root` with `MYSQL_ROOT_PASSWORD`. Set it back to `false` when done.

Passwords are set when MySQL first initialises its volume; changing the variables later does not change them (use phpMyAdmin's *User accounts* tab instead).

**Manage another Railway database** (MySQL or MariaDB, same project): on the phpMyAdmin service set `PMA_HOST` to that service's private domain (for example `${{MySQL.RAILWAY_PRIVATE_DOMAIN}}` or `{service}.railway.internal`) and `PMA_PORT` to `3306`, then redeploy. Railway's own MySQL template logs in as `root`, so also set `PMA_ALLOW_ROOT=true`. Several servers: empty `PMA_HOST` and set `PMA_HOSTS` (and `PMA_PORTS`) to comma-separated lists; phpMyAdmin then shows a server drop-down on the login page, and the template's login rules apply to every entry. A database in another project or provider needs its TCP proxy host and port. You can delete the bundled MySQL service if you only manage other databases.

**Connect your apps to the bundled MySQL**: reference `${{MySQL.MYSQL_URL}}` (app user) in your app's variables. MySQL has no public port; enable a TCP proxy on the MySQL service if you need to reach it from outside Railway.

**MySQL tuning**: `MYSQL_MEMORY_LIMIT_MB`, `MYSQL_BUFFER_POOL_MB` and `MYSQL_MAX_CONNECTIONS` default to `auto` (half the container memory for the buffer pool, capped at an 8 GB budget). Extra server options go in `MYSQL_EXTRA_ARGS`. Invalid values fall back to `auto`; they never stop MySQL from starting.

**Scaling and upgrades**: phpMyAdmin is stateless; raise `PMA_APACHE_WORKERS` for many users, or add replicas. To upgrade, change the image tag and digest in the service settings. MySQL stays on the 8.4 LTS series; moving to 9.x is a one-way upgrade, so take a dump first (phpMyAdmin *Export*, or `mysqldump`).

**Security notes**: only phpMyAdmin is public, and every action needs a MySQL login. There is no free-text server field, so the login page cannot be used to probe other hosts. This is a community template and is not affiliated with the phpMyAdmin project or Oracle.

### Why Deploy phpMyAdmin on Railway?

Railway runs phpMyAdmin and MySQL side by side on a private network with persistent volumes, HTTPS and logs handled for you. One click gives you a working database plus a browser admin for it, and the same phpMyAdmin can manage the other MySQL and MariaDB services in your project.


## Similar templates

- [RustFS | (Just Updated) S3 Object Store, Public URL and Keys Set](https://railway.com/deploy/rustfs-or-just-updated-s3-object-store-p) — S3-compatible object store, keys and public URL preset, volume kept
- [TimescaleDB](https://railway.com/deploy/timescaledb-railway-template) — A PostgreSQL-based time-series database for analytics on Railway.
- [Neo4j 2026.10 Community](https://railway.com/deploy/neo4j-202610-community) — Neo4j graph database with APOC, Browser, Bolt TCP proxy and a volume

Open this page in a browser: https://railway.com/deploy/phpmyadmin-52-with-mysql-84-lts
