Databases Azure

MariaDB with phpMyAdmin on Ubuntu 24.04 on Azure User Guide

| Product: MariaDB with phpMyAdmin on Ubuntu 24.04 LTS on Azure

Overview

MariaDB is one of the most widely deployed open source relational databases and a drop in replacement for MySQL, used as the SQL backend for web, application and transactional workloads. This cloudimg image pairs a MariaDB 10.11 server with phpMyAdmin, the standard browser based administration console, so the database is fully manageable the moment it boots, with no local client to install. From an ordinary browser you can create and edit databases and tables, run SQL, import and export data, and manage users and privileges. phpMyAdmin 5.2.3 is served by nginx and PHP 8.3 FPM on a hardened, fully patched Ubuntu 24.04 LTS base. The MariaDB server listens only on the loopback interface (127.0.0.1:3306) and keeps its data on a dedicated Azure data disk. A unique database root password, a phpMyAdmin control database and a random blowfish secret are all generated on the first boot of every VM, with no default login. Backed by 24/7 cloudimg support.

What is included:

  • MariaDB 10.11 server as the primary database, data on a dedicated Azure disk
  • phpMyAdmin 5.2.3 served by nginx and PHP 8.3 FPM, managed by systemd
  • The phpMyAdmin web console on :80 with cookie authentication
  • A per VM MariaDB root password generated on first boot and recorded in a root only file
  • The phpMyAdmin configuration storage (control database) fully set up, so no setup warning
  • MariaDB bound to 127.0.0.1 only, never exposed to the network
  • A dedicated Azure data disk at /var/lib/mysql for all databases
  • mariadb.service, nginx.service and php8.3-fpm.service as enabled systemd units
  • An unauthenticated /healthz endpoint for Azure Load Balancer health probes
  • 24/7 cloudimg support

Prerequisites

An active Azure subscription, an SSH key pair, and a VNet plus subnet in the target region. Standard_B2s (2 vCPU / 4 GiB RAM) is a sensible starting point; size up for larger databases or heavier query loads. NSG inbound: allow 22/tcp from your management network and 80/tcp for the web console. phpMyAdmin serves plain HTTP on port 80; for production, terminate TLS in front of it with your own domain. The MariaDB server is never exposed: it listens on 127.0.0.1 only, so port 3306 stays off the network.

Step 1 - Deploy from the Azure Marketplace

Sign in to the Azure Portal, choose Create a resource, search the Marketplace for MariaDB with phpMyAdmin by cloudimg, and select Create. On Basics pick your subscription, resource group, region and size; under Administrator account choose SSH public key and paste your key; under Inbound port rules allow SSH (22) and HTTP (80). Review the dedicated data disk on the Disks tab, then Review + create then Create.

Step 2 - Deploy from the Azure CLI

az vm create \
  --resource-group <your-rg> \
  --name mariadb-phpmyadmin \
  --image <marketplace-image-urn> \
  --size Standard_B2s \
  --admin-username azureuser \
  --generate-ssh-keys \
  --public-ip-sku Standard

Then open port 80 to the web console:

az vm open-port --resource-group <your-rg> --name mariadb-phpmyadmin --port 80

Step 3 - Confirm the services are running

SSH in as azureuser and confirm MariaDB, nginx and PHP FPM are all active. Note that MariaDB listens only on 127.0.0.1:3306 while nginx serves the web console on port 80.

systemctl is-active mariadb nginx php8.3-fpm mariadb-phpmyadmin-firstboot
ss -tlnp | grep -E ':80 |:3306 ' | sed 's/  */ /g'

The mariadb, nginx, php8.3-fpm and mariadb-phpmyadmin-firstboot services active, with nginx on port 80 and MariaDB bound to loopback 127.0.0.1:3306

Step 4 - Retrieve the per VM database password

Every VM generates its own MariaDB root password on first boot and writes it, along with the login user and URL, to a root only credentials file. Read it with sudo:

sudo cat /root/mariadb-phpmyadmin-credentials.txt

The per VM MariaDB credentials file, showing the login user root, the generated password and the phpMyAdmin URL

You sign in to phpMyAdmin as user root with the PHPMYADMIN_ROOT_PASSWORD from this file. On the box itself you can also run sudo mariadb to reach the database directly over the local socket without a password.

Step 5 - Sign in to phpMyAdmin

Browse to http://<vm-public-ip>/ and sign in with username root and the password from Step 4. phpMyAdmin uses cookie authentication, so your session is protected by the per VM blowfish secret.

The phpMyAdmin login page with the root user entered

Once signed in you land on the MariaDB server overview. The Databases tab lists every database on the server, with its collation and a link to check privileges.

The phpMyAdmin databases overview listing the databases on the MariaDB server

Step 6 - Browse tables and run SQL

Select a database in the left navigation to expand its tables, then click a table to browse its rows. The Browse view shows the data with inline edit, copy and delete actions, and lets you sort, search and page through large tables.

Browsing a table in phpMyAdmin, showing rows with inline edit, copy and delete actions

The SQL tab gives you a full query editor with syntax highlighting. Type any statement and click Go to run it; results appear below with options to export, chart or save the query.

The phpMyAdmin SQL query tab with a sample query entered and results shown

You can do the same from the command line on the VM. Read the root password from the credentials file and list the databases over the loopback interface:

PW=$(sudo grep '^PHPMYADMIN_ROOT_PASSWORD=' /root/mariadb-phpmyadmin-credentials.txt | cut -d= -f2-); mysql -h127.0.0.1 -uroot -p"$PW" -e 'SHOW DATABASES;'

Step 7 - Verify the stack

Confirm the MariaDB version, the phpMyAdmin and PHP versions, the health endpoint and the phpMyAdmin control database (the configuration storage that removes the setup warning):

mariadb --version
grep -oE "VERSION = '[0-9.]+'" /usr/share/phpmyadmin/libraries/classes/Version.php | head -1
php -v | head -1
curl -sI http://127.0.0.1/healthz | head -1

The MariaDB 10.11 version, phpMyAdmin 5.2.3 and PHP 8.3 versions, and the healthz endpoint returning 200

Step 8 - Where your data lives

All MariaDB databases live on a dedicated Azure data disk mounted at /var/lib/mysql, so your data is kept separate from the operating system disk and rides with the VM. Confirm the mount:

df -h /var/lib/mysql | tail -1
findmnt -no SOURCE,TARGET,FSTYPE /var/lib/mysql

The MariaDB datadir on the dedicated ext4 data disk mounted at /var/lib/mysql

Administering additional servers

The appliance is preconfigured for the local MariaDB server, but phpMyAdmin can administer other MySQL and MariaDB servers too. Add a second server block to /usr/share/phpmyadmin/config.inc.php with the remote host, then reload the login page and pick the server from the dropdown. Make sure the remote database allows connections from this VM and that any firewalls or NSGs permit the traffic.

Security notes

  • phpMyAdmin serves plain HTTP on port 80. For anything beyond a trusted network, put it behind your own TLS terminating reverse proxy or Azure Application Gateway with a certificate for your domain.
  • The MariaDB server listens on 127.0.0.1 only and is never reachable from the network. Administer it through phpMyAdmin or over SSH.
  • The per VM root password is unique to each VM. Keep /root/mariadb-phpmyadmin-credentials.txt protected and rotate the password if you share access.
  • On the box, sudo mariadb reaches the database over the local unix socket as root; there is no network usable default credential.
  • Restrict inbound 80/tcp in your NSG to the networks that need the web console.

Support

This image is maintained by cloudimg with 24/7 support. If you need help deploying or operating MariaDB with phpMyAdmin on Azure, contact us at cloudimg.co.uk.