On this page
- When is Adminer a better fit than phpMyAdmin?
- What do you need on the server?
- How do you download Adminer?
- How do you serve Adminer with Nginx on its own host name?
- What is the Apache version of that setup?
- How do you add HTTPS and open the firewall?
- How do you log in and check that it works?
- How do you update or remove Adminer?
- What goes wrong most often?
- Questions
When is Adminer a better fit than phpMyAdmin?
Pick Adminer when you want something tiny, quick to remove, or able to talk to more than one kind of database. The whole tool is a few hundred kilobytes, has no setup wizard and keeps no configuration database of its own. That makes it handy for a short maintenance job: copy it in, do the work, delete it. phpMyAdmin offers more MySQL-specific screens and comes from distribution packages with automatic updates, so it suits long-term daily use on a MySQL server. Both need the same protection, because each one exposes a database login form to the web.
What do you need on the server?
A web server with PHP-FPM, plus the PHP driver for each database type you want to open. If PHP is not there yet, follow the LEMP stack guide for Nginx or the LAMP guide for Apache. Then add the drivers:
sudo apt update
# MySQL or MariaDB
sudo apt install -y php-mysql
# PostgreSQL
sudo apt install -y php-pgsql
# SQLite files
sudo apt install -y php-sqlite3
php -m | grep -iE "mysqli|pdo_mysql|pgsql|sqlite"The last command lists the loaded drivers. Restart PHP-FPM after adding modules (sudo systemctl restart php8.3-fpm, with your version number) so the web side sees them too. The PHP and PHP-FPM page explains how versions and socket names differ across releases.
How do you download Adminer?
Fetch the current release from the project website into a dedicated directory that is not inside any application folder.
sudo mkdir -p /var/www/adminer
sudo curl -fsSL -o /var/www/adminer/index.php https://www.adminer.org/latest.php
sudo chown root:www-data /var/www/adminer/index.php
sudo chmod 640 /var/www/adminer/index.php
php -l /var/www/adminer/index.php
head -c 300 /var/www/adminer/index.phpThe latest.php link always points at the newest full build; latest-mysql.php is a smaller build that only speaks MySQL and MariaDB. Naming the file index.php means the host name alone opens it. php -l confirms the download is a valid PHP file and not an error page, and the first bytes include the version comment. Ubuntu and Debian also carry an adminer package, but it can lag behind; the single file is easier to keep current.
Root owns the file and the web server can only read it, so a bug in PHP cannot rewrite the tool.
How do you serve Adminer with Nginx on its own host name?
A dedicated subdomain such as dbtool.example.net keeps Adminer's cookies and rules apart from your main site. Create an A record for it (see DNS records), then add /etc/nginx/sites-available/dbtool.example.net:
server {
listen 80;
listen [::]:80;
server_name dbtool.example.net;
root /var/www/adminer;
index index.php;
allow 198.51.100.24;
allow 2001:db8:4f2a::/64;
deny all;
auth_basic "Database tools";
auth_basic_user_file /etc/nginx/adminer.htpasswd;
location = /index.php {
include fastcgi_params;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
fastcgi_pass unix:/run/php/php8.3-fpm.sock;
}
location / { try_files $uri /index.php?$args; }
}Only index.php is handed to PHP, so no other file in that folder can ever execute. Create the password file and enable the host:
sudo apt install -y apache2-utils
sudo htpasswd -c -B /etc/nginx/adminer.htpasswd deploy
sudo chown root:www-data /etc/nginx/adminer.htpasswd
sudo chmod 640 /etc/nginx/adminer.htpasswd
sudo ln -s /etc/nginx/sites-available/dbtool.example.net /etc/nginx/sites-enabled/
sudo nginx -t && sudo systemctl reload nginxWhat is the Apache version of that setup?
With Apache and PHP-FPM, a vhost and a Directory block give the same result. Save it as /etc/apache2/sites-available/dbtool.example.net.conf:
<VirtualHost *:80>
ServerName dbtool.example.net
DocumentRoot /var/www/adminer
<Directory /var/www/adminer>
AllowOverride None
AuthType Basic
AuthName "Database tools"
AuthUserFile /etc/apache2/adminer.htpasswd
<RequireAll>
Require valid-user
Require ip 198.51.100.24
</RequireAll>
</Directory>
</VirtualHost>sudo htpasswd -c -B /etc/apache2/adminer.htpasswd deploy
sudo a2ensite dbtool.example.net
sudo apachectl configtest && sudo systemctl reload apache2This assumes the PHP-FPM conf is already enabled with a2enconf, as in the LAMP guide.
How do you add HTTPS and open the firewall?
Request a certificate with the Certbot plugin for your web server. Both the basic auth password and the database password cross the network, so plain HTTP is not acceptable here.
# Nginx
sudo apt install -y certbot python3-certbot-nginx
sudo certbot --nginx -d dbtool.example.net
sudo ufw allow 'Nginx Full'
# Apache
sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d dbtool.example.net
sudo ufw allow 'Apache Full'Certbot needs to reach the host over port 80 for the HTTP challenge. Because the IP rule denies everyone else, the challenge request from the certificate authority can be blocked; if issuance fails, add location ^~ /.well-known/acme-challenge/ { allow all; auth_basic off; } to the Nginx block, or use a DNS challenge. Renewal is handled by the Certbot timer, and sudo certbot renew --dry-run confirms it will work. The Certbot guide covers both challenge types.
How do you log in and check that it works?
Open https://dbtool.example.net, pass the browser password prompt, then fill in the Adminer form: system (MySQL, PostgreSQL, SQLite), server localhost, a database user and its password. Use an account limited to the databases you need, created as shown in MySQL users and privileges. A quick test from the shell before opening the browser:
curl -I https://dbtool.example.net
# expect 401 without credentials
curl -I -u deploy https://dbtool.example.net
# expect 200 after entering the basic auth passwordAdminer refuses logins with an empty password by default, and it slows down repeated failed attempts on its own. For PostgreSQL, the user needs a password and a host rule in pg_hba.conf that allows local TCP connections, which is the default on current packages.
How do you update or remove Adminer?
Updating is a single download over the old file, followed by a syntax check:
sudo curl -fsSL -o /var/www/adminer/index.php https://www.adminer.org/latest.php
php -l /var/www/adminer/index.php
sudo systemctl reload php8.3-fpmAdminer also shows a notice on its login page when a newer release exists. If you only needed it for one job, removal is just as simple: delete /var/www/adminer, disable the site and reload the web server. A database tool that is not deployed cannot be attacked.
What goes wrong most often?
- "None of the supported PHP extensions" on the login page: the driver for that database is missing or PHP-FPM was not restarted after installing it.
- 403 Forbidden: your current IP is not on the allow list. Check it with
curl -4 ifconfig.mefrom your machine and update the rule. - File downloads instead of running: the FastCGI location or
a2enconfstep is missing, so PHP never sees the file. - Session expires instantly: the PHP session folder is not writable. Look at
session.save_pathinphp -ioutput for the FPM pool. - Large import fails: raise
upload_max_filesizeandpost_max_sizein the FPMphp.ini, or import over SSH with the database client.
Plans that fit this guide
Base city prices. Every plan includes a dedicated IPv4 address, IPv6, full root and all 18 images.
Questions about Adminer: one-file database UI
Is Adminer free to use?
Yes. It is open source under the Apache License 2.0 or GPL 2, so you can run it on any server you manage.
Which databases can Adminer manage?
The full build handles MySQL, MariaDB, PostgreSQL and SQLite, with more systems available through plugins. Each needs its PHP driver installed.
Can I log in to SQLite without a password?
Not by default, because passwordless logins are blocked. A login plugin from the Adminer project can allow it for a specific file; keep the HTTP password in front if you do.
Should Adminer live inside my application folder?
No. A separate folder and host name keep it outside your app deploys, so a release cannot remove or expose it by accident.
How is Adminer different from Adminer Editor?
Adminer Editor is a simplified data entry interface for end users. The regular Adminer build is the one for administrators who manage schemas and run SQL.