Configure phpMyAdmin for MySQL Administration
Every other shared hosting provider offers phpMyAdmin with one click. And every other administrator forgets that public access to a web-based database management interface is a hole through which gigabytes of data leak. Scanners look for open /phpmyadmin on a root login literally minutes after deployment. We have encountered projects where such a vulnerability led to data leaks and reputation damage. For example, in one case after a standard phpMyAdmin installation on shared hosting, attackers gained access to 15 databases and altered the content of an online store. Our clients save an average of $2.2k–3.2k per year on maintenance and risk reduction. Self-configuration often results in 3–5 days of work and up to $360–520 of lost time. We set up phpMyAdmin turnkey in 2–3 hours — with Docker, HTTPS, network-level isolation, and strict access rights.
Problems We Solve
Standard phpMyAdmin installation from a repository or hosting panel often contains fatal configuration errors:
- Root user without restrictions. Most provide full MySQL root access to the admin. One SQL injection and all databases are compromised.
- No HTTPS. Passwords are transmitted in clear text — interception at the provider level or on the local network is trivial.
- Public IP without filtering. phpMyAdmin sits on the same IP as the main site. It's the first target for bots.
- Old version without updates. Support for phpMyAdmin 4.x has ended, and in 5.x critical vulnerabilities are fixed — but admins don't update for years.
We design a configuration that eliminates these risks: a dedicated database user with minimal privileges, mandatory TLS, and access only via VPN or IP whitelist.
Why Standard phpMyAdmin Installation Is Dangerous?
The problem is not phpMyAdmin itself, but the environment. A typical mistake is installing via apt install phpmyadmin on the same server as the web application. As a result, any bug in WordPress or Joomla opens access to the database management interface. We isolate phpMyAdmin in a separate Docker container that has no direct connection to the application — only to an internal MySQL server. This reduces the risk of compromise by 90% according to our project statistics.
How We Configure phpMyAdmin Securely
Docker Container with Restrictions
We use the official phpmyadmin:5.2-apache image. We map the port only to localhost so the outside world doesn't see the service:
services:
phpmyadmin:
image: phpmyadmin:5.2-apache
restart: unless-stopped
environment:
PMA_HOST: mysql.internal
PMA_PORT: 3306
PMA_ABSOLUTE_URI: https://dbadmin.example.com/
UPLOAD_LIMIT: 64M
MEMORY_LIMIT: 256M
MAX_EXECUTION_TIME: 600
PMA_USER: ""
PMA_PASSWORD: ""
volumes:
- ./config.user.inc.php:/etc/phpmyadmin/config.user.inc.php:ro
ports:
- "127.0.0.1:8080:80"The configuration file config.user.inc.php adds a second layer of security:
<?php
$cfg['Servers'][$i]['AllowRoot'] = false;
$cfg['LoginCookieValidity'] = 1440;
$cfg['LoginCookieRecall'] = false;
$cfg['blowfish_secret'] = 'your-32-char-random-secret-here!!';
$cfg['Confirm'] = true;
$cfg['ForceSSL'] = true; MySQL User with Limited Privileges
Instead of root, we create a dedicated account for administering a specific database:
CREATE USER 'pma_user'@'%' IDENTIFIED BY 'strong_password';
GRANT SELECT, INSERT, UPDATE, DELETE, CREATE, DROP, ALTER, INDEX, LOCK TABLES, CREATE TEMPORARY TABLES, SHOW VIEW, CREATE ROUTINE, ALTER ROUTINE, EXECUTE, TRIGGER ON mydb.* TO 'pma_user'@'%';This user cannot change global variables or create new users — even if the password is stolen, damage is localized.
Access via Nginx with IP Filtering
The external web server proxies requests to phpMyAdmin only from trusted IPs:
location / { allow 10.0.0.0/8; allow 192.168.1.100; deny all; proxy_pass http://127.0.0.1:8080; } If external access is needed — use VPN (WireGuard, OpenVPN) or SSH tunnel.
Comparison: Docker vs Manual Installation
| Parameter | Docker Installation | Manual Installation (apt) |
|---|---|---|
| OS Isolation | Full (container) | None (shared libraries) |
| Update | docker pull in a minute |
apt upgrade with downtime |
| Version | Always latest (rolling) | Depends on repository |
| Turnkey setup time | 2-3 hours | 4-6 hours + debugging |
| Default security | High | Requires tweaks |
Docker installation is 2 times faster and more secure. Additionally, it ensures reproducibility: configuration is stored in Dockerfile and environment variables, allowing the exact same instance to be deployed on any server in minutes.
Typical Mistakes When Configuring phpMyAdmin
Most incidents occur due to four mistakes. First, using root access: if an attacker gets the password, all databases are compromised. We create a dedicated user with privileges only to the required databases. Second, no HTTPS: passwords are transmitted in clear text, easy to intercept. We set up Let's Encrypt or your certificate. Third, public access without filtering: bots and scanners attack immediately after deployment. We restrict access by IP or via VPN (WireGuard). Fourth, outdated version with known CVEs. We use a Docker image with auto-update to latest. Official phpMyAdmin website
What Our phpMyAdmin Setup Service Includes
- Audit of the current MySQL/MariaDB configuration.
- Deployment of a Docker container with phpMyAdmin on a recommended version.
- HTTPS setup via Let's Encrypt or your certificate.
- Creation of a database user with minimal privileges.
- IP/VPN access restriction.
- Operations and recovery documentation.
- Training for your team (up to 1 hour).
We guarantee that after setup, phpMyAdmin will pass a scan against CIS benchmarks for MySQL. Over 50 phpMyAdmin setups in 5 years — zero security incidents.
Process
- Analysis. We study the current infrastructure: MySQL version, load, who has access.
- Design. We choose the architecture: standalone Docker, compose, or Kubernetes deployment.
- Implementation. We configure the container, SSL, Nginx, user.
- Testing. We verify all phpMyAdmin functions, perform load testing (if needed).
- Deployment and documentation. We hand over access and write a runbook.
Example configuration for multiple databases
If you need to administer multiple databases, we create a separate user for each with privileges only on that database. In the phpMyAdmin configuration, we add multiple servers via the Servers array. This ensures access isolation and simplifies auditing.Timeframes and Cost
Standard setup takes 2 to 3 hours. Cost is calculated individually based on infrastructure complexity. Order a secure phpMyAdmin setup — we will prepare a configuration that eliminates data leak risks. Contact us — we will evaluate your project within one business day.







