On this pagePick an access model
Adminer is a complete database manager in a single PHP file. The current release, 6.3.0 from November 2026, supports PostgreSQL, MySQL, MariaDB, SQLite, Oracle and MS SQL without add-ons (plugins cover other engines) and ships under a dual Apache 2.0 or GPL 2 license. That simplicity is also its risk. Dropped on a public web server, Adminer is a login form in front of your database that anyone can probe, and like any web app it has had security bugs in the past. The safe default is to never expose it at all.
Pick an access model
| Model | Public exposure | Effort | Best for |
|---|---|---|---|
| On demand, through an SSH tunnel | None | Lowest | One admin, occasional use |
| Official container on loopback | None | Low | Docker hosts and containerized databases |
| Nginx with allowlist, password and HTTPS | One hardened URL | Highest | Several people who cannot use SSH |
The first two never open a port. Use the third only when the first two genuinely do not work for your team.
Before you log in: give Adminer its own database user
On Ubuntu, the MariaDB and MySQL root accounts authenticate through the Unix socket rather than a password, and Adminer refuses password-less logins by design. Both facts push you toward the right habit: a dedicated account with only the rights it needs. For MariaDB or MySQL, in sudo mariadb (or sudo mysql):
CREATE USER 'dbadmin'@'localhost' IDENTIFIED BY 'a-long-random-password';
GRANT ALL PRIVILEGES ON shop.* TO 'dbadmin'@'localhost';
For PostgreSQL, create a role that you then make owner of the databases it should manage:
sudo -u postgres createuser --pwprompt dbadmin
sudo -u postgres psql -c "ALTER DATABASE shop OWNER TO dbadmin;"
Scope the grants to the databases this person actually administers. A tool that can do everything turns one leaked password into a full breach.
Option 1: on demand, through an SSH tunnel
Install the PHP command-line interpreter and the drivers for your databases. Ubuntu 24.04 ships PHP 8.3 and Ubuntu 26.04 ships PHP 8.5; Adminer runs on either:
sudo apt install php-cli php-mysql php-pgsql php-sqlite3
sudo mkdir -p /opt/adminer
sudo curl -fsSL -o /opt/adminer/index.php \
https://github.com/vrana/adminer/releases/download/v6.3.0/adminer-6.3.0.php
When you need it, start PHP's built-in web server on the loopback interface, as your normal user rather than root:
php -S 127.0.0.1:8080 -t /opt/adminer
On your own computer, open a tunnel in another terminal. The same command works in PowerShell on Windows 10 and 11, which include an OpenSSH client:
ssh -N -L 8080:127.0.0.1:8080 admin@203.0.113.10
Browse to http://localhost:8080, choose the database system, and log in with localhost as the server. When you are done, press Ctrl+C in both terminals. At no point does anything listen on a public interface. PHP's built-in server is meant for development, which is acceptable here because only you, through the tunnel, can reach it.
Make it one command
Once this works, start the server and the tunnel together. The -t flag gives the remote command a terminal, so a single Ctrl+C stops PHP and closes the tunnel:
ssh -t -L 8080:127.0.0.1:8080 admin@203.0.113.10 \
php -d upload_max_filesize=64M -d post_max_size=64M \
-S 127.0.0.1:8080 -t /opt/adminer
The two -d options raise PHP's default upload limits (2 MB per file and 8 MB per request) for this session only, which matters as soon as you import a dump through the browser.
Option 2: the official container, bound to loopback
The Docker Official Image named adminer follows upstream releases and was at 6.3.0 when this was written. If your database runs in a container, attach Adminer to the same Docker network and publish it on loopback only:
docker network ls
docker run --rm --name adminer \
--network myapp_default \
-p 127.0.0.1:8080:8080 \
adminer:6.3.0
Replace myapp_default with your Compose project's network from the first command. Open the same SSH tunnel as in option 1, and in the login form use the database container's service name, such as db, as the server. Because of --rm, the container disappears when you stop it, so the tool only exists while you use it. Binding to 127.0.0.1 also matters on hosts that rely on ufw, since ports Docker publishes on all interfaces can bypass its rules.
Option 3: a permanent install behind Nginx
If several people need a URL, stack independent layers so that no single mistake exposes the database: an IP allowlist, an HTTP password, HTTPS, Adminer's own login and the limited database user from above.
sudo apt install nginx php-fpm php-mysql php-pgsql apache2-utils certbot python3-certbot-nginx
sudo mkdir -p /var/www/adminer
sudo curl -fsSL -o /var/www/adminer/index.php \
https://github.com/vrana/adminer/releases/download/v6.3.0/adminer-6.3.0.php
sudo htpasswd -c /etc/nginx/adminer.htpasswd alice
Create /etc/nginx/sites-available/adminer. The access rules sit inside location /, so they cover every page, including PHP, while Certbot's own challenge location is left alone:
server {
listen 80;
server_name db.example.com;
root /var/www/adminer;
index index.php;
location / {
allow 198.51.100.25;
deny all;
auth_basic "Adminer";
auth_basic_user_file /etc/nginx/adminer.htpasswd;
location ~ \.php$ {
include snippets/fastcgi-php.conf;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
}
}
Use php8.5-fpm.sock on Ubuntu 26.04, and replace 198.51.100.25 with your office or VPN address. Then enable the site and add a certificate:
sudo ln -s /etc/nginx/sites-available/adminer /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginx
sudo certbot --nginx -d db.example.com
Adminer also slows down repeated failed logins from one address and offers optional plugins, including one that adds a one-time password to the login form. Treat those as extra layers, not as replacements for the allowlist.
Once you are in
Adminer covers most routine work from one screen: browsing and editing rows, running ad hoc SQL with timings, altering tables and indexes, managing users and grants, and drawing a diagram of tables and their foreign keys. Two habits keep it from causing trouble:
- Export before risky changes. Its export writes SQL or CSV, optionally compressed, which is a quick safety net before an
ALTER TABLE. It is not a backup strategy; scheduled dumps stored off the server are, as the backup plan guide explains. - Import large files from the shell. Browser uploads go through PHP limits and time-outs. For anything big, copy the dump to the server and load it with
mariadb shop < dump.sqlorpsql -d shop -f dump.sqlinstead.
Close the doors behind it
- Keep databases on loopback. MariaDB, MySQL and PostgreSQL on Ubuntu listen on localhost by default. Adminer runs on the same server, so they never need a public port.
- Filter at the network edge. On CloudSat, a cloud firewall that admits only SSH, plus 80 and 443 if you chose option 3, adds a second wall in front of the server's own firewall.
- Update or remove. Adminer shows a notice when a new version is out; replace the file the same day. If you stop needing option 3, delete the file and the server block. A tool that is not installed cannot be attacked.
FAQ
Adminer or phpMyAdmin?
Adminer is a single file that speaks several database systems, which makes it easy to run on demand and remove afterward. phpMyAdmin focuses on MySQL and MariaDB with a larger interface. For occasional administration over a tunnel, Adminer's footprint is hard to beat.
Why can I not log in as root?
On Ubuntu, MariaDB and MySQL root use socket authentication with no password, and Adminer rejects password-less logins. Create a dedicated user with a password, as shown above, instead of giving root a password.
Can Adminer manage MongoDB or Redis?
Not with the default file. Adminer's built-in drivers cover SQL databases, and extra drivers, including MongoDB, come as plugins. For MongoDB, the official shell mongosh over SSH is usually simpler.
Is the SSH tunnel slower?
Not noticeably for this kind of work. The tunnel adds encryption you would want anyway, and the bulk of the work happens on the server, next to the database.
Run it on CloudSat. Cloud VPS on AMD EPYC and NVMe from $1.98/mo in 13 regions, delivered in under 5 minutes and paid in crypto. See plans or deploy a server.




