Updated: 18 November 2026 · Applies to: Ubuntu 24.04, Debian 12, AlmaLinux 9 and Rocky Linux 9

CentOS 7 reached end of life on 30 June 2024, so this guide now uses AlmaLinux 9 / Rocky Linux 9 (the steps also suit other RHEL 9 rebuilds).

phpMyAdmin manages MySQL/MariaDB in a browser. Because it is a common target for attacks, install it with extra protection.

Before you start

  • A VPS or dedicated server with a fresh Ubuntu 24.04 / Debian 12 or AlmaLinux 9 / Rocky Linux 9 installation, and root or sudo access.
  • A domain or subdomain pointing to the server (an A record), if you want HTTPS.
  • The system updated: apt update && apt upgrade or dnf upgrade.

Install

apt install phpmyadmin                                   # Ubuntu / Debian (choose apache2 when asked)
dnf install epel-release && dnf install phpMyAdmin       # AlmaLinux / Rocky

Secure it

  • Serve it over HTTPS only (see the certificate step below).
  • Allow only your IP address. On AlmaLinux/Rocky edit /etc/httpd/conf.d/phpMyAdmin.conf and set Require ip 203.0.113.10; on Ubuntu add a <Directory /usr/share/phpmyadmin> block with the same rule.
  • Add a second password prompt with HTTP basic authentication, or change the URL alias from /phpmyadmin to something less obvious.
  • Log in with a normal database user, not root.

Reload Apache after changes.

Add a free SSL certificate

apt install certbot python3-certbot-apache                     # Ubuntu / Debian
dnf install epel-release && dnf install certbot python3-certbot-apache   # AlmaLinux / Rocky
certbot --apache -d example.com -d www.example.com

Certbot installs a timer that renews the certificate automatically; test it with certbot renew --dry-run.

Related services

KVM VPS hosting

NVMe SSD and full root access, with Free Basic Managed Support.

Unmanaged dedicated servers

full root access and free IPMI KVM, with Free Basic Managed Support.

Managed dedicated servers

our engineers look after the server for you, from $135 a month.

Was this answer helpful?

Still stuck? Open a ticket