Databases Azure

phpMyAdmin on Ubuntu 24.04 on Azure User Guide

| Product: phpMyAdmin on Ubuntu 24.04 LTS on Azure

Overview

phpMyAdmin is the most widely used web interface for administering MySQL and MariaDB databases. From an ordinary browser you can browse and edit tables, run SQL, import and export data, manage users and privileges, and monitor the server, with no local client to install. The cloudimg image ships phpMyAdmin 5.2.3 served by nginx and PHP 8.3 FPM on a hardened, fully patched Ubuntu 24.04 LTS base, together with a bundled local MariaDB server so the appliance is useful on its own. phpMyAdmin runs behind an nginx reverse proxy on port 80. The bundled MariaDB 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. Backed by 24/7 cloudimg support.

What is included:

  • phpMyAdmin 5.2.3 served by nginx and PHP 8.3 FPM, managed by systemd
  • A bundled MariaDB 10.11 server, the database phpMyAdmin administers out of the box
  • The phpMyAdmin web interface 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
  • nginx.service, php8.3-fpm.service and mariadb.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 interface. phpMyAdmin serves plain HTTP on port 80; for production, terminate TLS in front of it with your own domain. The bundled MariaDB 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 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 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 interface:

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

Step 3 - Confirm the services are running

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

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

The nginx, php8.3-fpm, mariadb and 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/phpmyadmin-credentials.txt

The per VM phpMyAdmin 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 server overview. The Databases tab lists every database on the bundled MariaDB server, with its collation and a link to check privileges.

The phpMyAdmin databases overview listing the databases on the bundled 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 GROUP BY query entered

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/phpmyadmin-credentials.txt | cut -d= -f2-); mysql -h127.0.0.1 -uroot -p"$PW" -e 'SHOW DATABASES;'

Step 7 - Verify the stack

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

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

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

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

Connecting phpMyAdmin to additional servers

The appliance is preconfigured for the bundled local MariaDB, 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 bundled MariaDB 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/phpmyadmin-credentials.txt protected and rotate the password if you share access.
  • Restrict inbound 80/tcp in your NSG to the networks that need the web interface.

Support

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