Adminer is a lightweight database management tool packaged as a single PHP file. It supports MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, and CockroachDB – all from one 497 KB file you drop into a web directory. If you have ever dealt with the bloated setup of phpMyAdmin, Adminer is a welcome alternative that just works.
This guide walks through installing Adminer 5.4.2 on Ubuntu 24.04 LTS and Rocky Linux 10. We cover web server configuration for both Nginx and Apache, HTTPS with Let’s Encrypt, connecting to MySQL/MariaDB and PostgreSQL, basic database operations, and security hardening. The same steps apply to Debian 13, AlmaLinux 10, and RHEL 10 with minimal changes.
Prerequisites
Before starting, confirm you have the following in place:
- A server running Ubuntu 24.04 LTS or Rocky Linux 10 with root or sudo access
- A running database server – MariaDB, MySQL, or PostgreSQL
- A domain name pointed to your server (for HTTPS setup) – or use the server IP for testing
- Ports 80 and 443 open in your firewall
Step 1: Install PHP and a Web Server
Adminer needs PHP with a few database extensions and a web server to serve it. Pick either Nginx or Apache based on your environment.
Option A: Nginx + PHP-FPM
On Ubuntu 24.04:
sudo apt update
sudo apt install -y nginx php-fpm php-mysql php-pgsql php-mbstring php-json
On Rocky Linux 10:
sudo dnf install -y nginx php-fpm php-mysqlnd php-pgsql php-mbstring php-json
Enable and start both services after installation.
Ubuntu:
sudo systemctl enable --now nginx php8.3-fpm
Rocky Linux:
sudo systemctl enable --now nginx php-fpm
Option B: Apache + PHP
On Ubuntu 24.04:
sudo apt update
sudo apt install -y apache2 libapache2-mod-php php-mysql php-pgsql php-mbstring php-json
On Rocky Linux 10:
sudo dnf install -y httpd php php-mysqlnd php-pgsql php-mbstring php-json
Enable and start Apache.
Ubuntu:
sudo systemctl enable --now apache2
Rocky Linux:
sudo systemctl enable --now httpd
Verify PHP is installed and working by checking the version.
php -v
You should see the PHP version along with the build date and Zend Engine info:
PHP 8.3.6 (cli) (built: Mar 2026)
Copyright (c) The PHP Group
Zend Engine v4.3.6, Copyright (c) Zend Technologies
with Zend OPcache v8.3.6, Copyright (c), by Zend Technologies
Step 2: Download and Install Adminer
Adminer ships as a single PHP file. Download it directly from the official GitHub repository and place it in a web-accessible directory.
sudo mkdir -p /var/www/adminer
sudo curl -L -o /var/www/adminer/index.php https://github.com/vrana/adminer/releases/download/v5.4.2/adminer-5.4.2.php
Set proper ownership so the web server can read the file.
Ubuntu (Nginx/Apache):
sudo chown -R www-data:www-data /var/www/adminer
Rocky Linux (Nginx/Apache):
sudo chown -R nginx:nginx /var/www/adminer
If using Apache on Rocky Linux, set the owner to apache:apache instead.
Verify the download completed and the file size is correct.
ls -lh /var/www/adminer/index.php
The file should be around 497 KB:
-rw-r--r-- 1 www-data www-data 497K Mar 22 10:00 /var/www/adminer/index.php
Step 3: Configure Nginx or Apache Virtual Host
Create a dedicated virtual host so Adminer runs on its own domain or subdomain. Replace adminer.example.com with your actual hostname throughout.
Nginx Virtual Host Configuration
Create the Nginx server block configuration file.
sudo vi /etc/nginx/conf.d/adminer.conf
Add the following server block. On Ubuntu, update the PHP-FPM socket path to match your PHP version (e.g., php8.3-fpm.sock).
server {
listen 80;
server_name adminer.example.com;
root /var/www/adminer;
index index.php;
location / {
try_files $uri $uri/ =404;
}
location ~ \.php$ {
include fastcgi_params;
fastcgi_pass unix:/run/php/php8.3-fpm.sock; # Ubuntu
# fastcgi_pass unix:/run/php-fpm/www.sock; # Rocky Linux
fastcgi_index index.php;
fastcgi_param SCRIPT_FILENAME $document_root$fastcgi_script_name;
}
# Block access to hidden files
location ~ /\. {
deny all;
}
}
Test the configuration and reload Nginx.
sudo nginx -t && sudo systemctl reload nginx
You should see a successful test result:
nginx: the configuration file /etc/nginx/nginx.conf syntax is ok
nginx: configuration file /etc/nginx/nginx.conf test is successful
Apache Virtual Host Configuration
On Ubuntu, create a virtual host config in /etc/apache2/sites-available/.
sudo vi /etc/apache2/sites-available/adminer.conf
Add this virtual host block:
<VirtualHost *:80>
ServerName adminer.example.com
DocumentRoot /var/www/adminer
<Directory /var/www/adminer>
AllowOverride All
Require all granted
</Directory>
<FilesMatch \.php$>
SetHandler "proxy:unix:/run/php/php8.3-fpm.sock|fcgi://localhost"
</FilesMatch>
</VirtualHost>
Enable the site and reload Apache.
sudo a2ensite adminer.conf
sudo a2enmod proxy_fcgi
sudo systemctl reload apache2
On Rocky Linux, place the config at /etc/httpd/conf.d/adminer.conf and reload with sudo systemctl reload httpd.
Step 4: Secure Adminer with HTTPS Using Let’s Encrypt
Running a database management tool over plain HTTP is a serious risk – credentials travel in cleartext. Set up HTTPS with Let’s Encrypt free certificates using Certbot.
Install Certbot on Ubuntu 24.04:
sudo apt install -y certbot python3-certbot-nginx
Install Certbot on Rocky Linux 10:
sudo dnf install -y certbot python3-certbot-nginx
If using Apache, replace python3-certbot-nginx with python3-certbot-apache.
Request and install the certificate. Certbot modifies your Nginx or Apache config automatically to serve HTTPS.
sudo certbot --nginx -d adminer.example.com
For Apache, use --apache instead of --nginx. Follow the interactive prompts to complete the setup. Certbot handles automatic renewal through a systemd timer.
Verify the timer is active for automatic renewals.
sudo systemctl status certbot.timer
The timer should show as active and enabled:
● certbot.timer - Run certbot twice daily
Loaded: loaded (/lib/systemd/system/certbot.timer; enabled)
Active: active (waiting)
Step 5: Connect to MySQL or MariaDB with Adminer
Open your browser and navigate to https://adminer.example.com. The Adminer login page presents fields for the database system, server, username, password, and database name.
To connect to a MySQL or MariaDB server:
- System – select MySQL
- Server – enter
localhostor the remote server IP - Username – your database user (e.g.,
rootor a dedicated user) - Password – the user’s password
- Database – leave blank to see all databases, or enter a specific name
Click Login. If using MariaDB, select “MySQL” as the system – Adminer uses the same driver for both since MariaDB is wire-compatible with MySQL.
If the connection fails with “Access denied”, confirm the database user can connect from localhost. For MariaDB, check with:
sudo mariadb -e "SELECT user, host FROM mysql.user WHERE user='root';"
Step 6: Connect to PostgreSQL with Adminer
Adminer handles PostgreSQL connections through the same interface. On the login screen:
- System – select PostgreSQL
- Server – enter
localhostor the PostgreSQL server address - Username – your PostgreSQL user (e.g.,
postgres) - Password – the user’s password
- Database – enter the target database name (e.g.,
postgres)
PostgreSQL requires the php-pgsql extension we installed earlier. If you see a “No extension” error, verify the extension is loaded.
php -m | grep pgsql
The output should show both the base and PDO PostgreSQL extensions:
pdo_pgsql
pgsql
If the extension is missing, install it and restart PHP-FPM.
sudo apt install -y php-pgsql
sudo systemctl restart php8.3-fpm
Also confirm that PostgreSQL allows password authentication in pg_hba.conf. The md5 or scram-sha-256 method is required for Adminer to connect – peer authentication only works for local socket connections, not web-based tools.
Step 7: Basic Database Operations in Adminer
Once logged in, Adminer shows the database dashboard with a clean sidebar listing all databases. Here are the most common operations.
Create a New Database
Click “Create database” in the top navigation. Enter the database name and select the collation. For MySQL/MariaDB, utf8mb4_general_ci is the standard choice for modern applications. For PostgreSQL, the default UTF8 encoding works for most setups. Click Save.
Create Tables
Select a database from the sidebar, then click “Create table”. The table editor provides a visual form where you define column names, types, default values, indexes, and foreign keys. This is faster than writing DDL by hand for quick prototyping.
Run SQL Queries
Click “SQL command” in the top navigation to open the query editor. Type or paste your SQL and click Execute. Results appear in a formatted table below the editor. You can run multiple statements separated by semicolons.
Example query to test on a MySQL/MariaDB server:
SELECT VERSION();
SHOW DATABASES;
SHOW VARIABLES LIKE 'max_connections';
For PostgreSQL, use standard SQL syntax:
SELECT version();
SELECT datname FROM pg_database;
SHOW max_connections;
Step 8: Import and Export Databases
Adminer includes built-in import and export tools accessible from the top navigation bar of any database view.
Export a Database
Click “Export” from the top menu. Adminer gives you several options:
- Output – choose “save” for file download or “open” for in-browser display
- Format – SQL is the standard choice for backups and migrations
- Tables – select specific tables or export everything
- Data – choose between structure only, data only, or both
Click Export to download the SQL dump file. For large databases, use the command-line mysqldump or pg_dump tools instead – Adminer’s export runs through PHP memory limits and may time out on databases larger than a few hundred megabytes.
Import a Database
Click “Import” from the top menu. You can upload a SQL file or paste SQL directly into the text box. Click Execute to run the import. The maximum upload size depends on your PHP configuration – check upload_max_filesize and post_max_size in your php.ini if large imports fail.
To increase the upload limit for larger imports, edit the PHP configuration.
sudo vi /etc/php/8.3/fpm/php.ini
Find and update these directives:
upload_max_filesize = 256M
post_max_size = 256M
memory_limit = 512M
max_execution_time = 300
On Rocky Linux, the PHP config path is /etc/php.ini. Restart PHP-FPM after making changes.
sudo systemctl restart php8.3-fpm
Step 9: Security Hardening for Adminer
A database management tool exposed to the internet is a high-value target. Lock it down with these measures.
Restrict Access by IP Address
The most effective protection is limiting access to known IPs. In Nginx, add an allow/deny block to the server configuration.
sudo vi /etc/nginx/conf.d/adminer.conf
Add IP restriction rules inside the server block. Replace 10.0.1.50 with your actual IP address or office CIDR range:
server {
listen 443 ssl;
server_name adminer.example.com;
root /var/www/adminer;
index index.php;
# Restrict to trusted IPs only
allow 10.0.1.50;
allow 192.168.1.0/24;
deny all;
# ... rest of config
}
Reload Nginx after the change.
sudo nginx -t && sudo systemctl reload nginx
Apache .htaccess IP Restriction
For Apache, create an .htaccess file in the Adminer directory.
sudo vi /var/www/adminer/.htaccess
Add the following directives to restrict access by IP:
Require ip 10.0.1.50
Require ip 192.168.1.0/24
Firewall Rules
On Ubuntu, if you use UFW, allow HTTP and HTTPS only from trusted networks.
sudo ufw allow from 10.0.1.0/24 to any port 443
sudo ufw reload
On Rocky Linux with firewalld:
sudo firewall-cmd --permanent --add-rich-rule='rule family="ipv4" source address="10.0.1.0/24" port protocol="tcp" port="443" accept'
sudo firewall-cmd --reload
Additional Security Measures
Consider these hardening steps for production environments:
- Rename the file – rename
index.phpto something non-obvious likedbadmin-x7k2.phpto avoid automated scanners that probe for/adminer.php - HTTP Basic Auth – add a second authentication layer in Nginx or Apache before Adminer’s own login page
- Disable when not in use – rename or move the file when you do not need database access. A tool that is not running cannot be exploited
- Use dedicated database users – never connect with the root account. Create users with specific privileges for the databases they need to manage
- Monitor access logs – watch your web server logs for unauthorized access attempts
Adminer vs phpMyAdmin – Feature Comparison
The table below shows the key differences between Adminer and phpMyAdmin, the two most common PHP-based database management tools.
| Feature | Adminer 5.4.2 | phpMyAdmin |
|---|---|---|
| File size | Single PHP file (497 KB) | Multiple files (15+ MB) |
| Database support | MySQL, MariaDB, PostgreSQL, SQLite, MS SQL, Oracle, CockroachDB | MySQL and MariaDB only |
| Installation | Drop one file into web root | Extract archive, configure config.inc.php |
| PHP requirement | PHP 7.1+ | PHP 8.1+ |
| Themes/skins | Supported via CSS plugins | Built-in theme system |
| Security | No default login – requires credentials | Needs manual hardening of config |
| Editor mode | Yes – restricted interface for non-admin users | No built-in restricted mode |
| Plugin system | PHP-based plugins | Limited extension support |
Adminer wins on portability and multi-database support. phpMyAdmin has a more polished interface and deeper MySQL-specific features like advisor recommendations and query profiling. For teams that manage both MySQL and PostgreSQL, Adminer is the practical choice since one tool handles everything.
Conclusion
Adminer gives you a complete database management interface from a single PHP file – no package managers, no dependency chains, no multi-step installations. We covered installing it on Ubuntu 24.04 and Rocky Linux 10 with Nginx/Apache, securing it with HTTPS, and connecting to both MySQL/MariaDB and PostgreSQL.
For production use, always restrict access by IP, enforce HTTPS, and use dedicated database accounts with limited privileges. Consider disabling Adminer entirely when not actively managing databases – the safest tool is one that is not running.