phpMyAdmin is a free, web-based tool for managing MySQL and MariaDB databases. From the interface in your browser, you can create databases and users, edit tables, run your own SQL queries, and back up databases by exporting them—all without manually typing SQL commands.
In this guide, we’ll show you two ways to install it: the easy way as a One-Click App, which makes phpMyAdmin available over HTTPS in just a few clicks, and a manual installation with Apache and PHP using the command line. Afterward, you’ll learn how to create databases and users, import and export data, and increase the upload limit for large SQL files.
phpMyAdmin is not a database itself; it’s an interface for a database that is already running. This can be MariaDB or MySQL on the same server, for example, set up as described in How to Set Up MariaDB on a Linux Server or How to Set Up Databases on a Linux Server, or another database server that your server can access. phpMyAdmin is a good fit if:
- You prefer managing databases with a mouse rather than the command line, for example, for WordPress, a forum, an online store, or a game server plugin’s database.
- You want to import or export SQL files, for example, when moving a website or making a quick backup before an update.
- Several people need to manage databases but should not have SSH access to the server.
- You want to check tables or edit individual entries without having to memorize SQL commands.
phpMyAdmin is less suitable for very large databases with dumps in the gigabyte range: imports and exports run through the browser and are subject to upload and time limits, so the command line is more reliable for this. phpMyAdmin is not designed for PostgreSQL. If you use the ZAP Webspace One-Click App or a game server with a database, you don’t need to install it yourself, as explained in the note in the next section.
With your server’s One-Click Apps, phpMyAdmin can be up and running in just a few minutes, without having to configure a web server and PHP yourself. The app does not include its own database: when you log in, you specify which MySQL or MariaDB server phpMyAdmin should connect to.
- A Linux VPS (Debian or Ubuntu) with One-Click Apps set up. For instructions, see VPS: One-Click Apps.
- A MySQL or MariaDB database that is accessible over the internet, such as the MariaDB One-Click App. For instructions, see How to Set Up MariaDB on a Linux Server.
The ZAP Webspace and ZAP Webspace + Mail apps already include phpMyAdmin. Open it using the phpMyAdmin link on the app card; see Web Hosting: Set Up a Website with ZAP Webspace. There’s also a separate access point for your game server’s database; see Game Server: PHPMyAdmin Access.
- Open your VPS in the ZapX dashboard and go to the One-Click Apps tab.
- Search for “phpMyAdmin” in the App Catalog and click Install next to phpMyAdmin.
- Use a custom subdomain or zap.cloud is already selected, with a randomly generated name. Leave this option enabled or enter your own name: with a domain, phpMyAdmin is available over HTTPS, so your database passwords are encrypted in transit.
- Click Queue installation. After about a minute, the app will show as Online. You don’t need to fill in any other fields.
Open phpMyAdmin using the Access link on the app card. The login page asks for three details:
| Field | What to enter |
|---|---|
| Server | The IP address or hostname of your database server. If the database does not use port 3306, append the port, for example, 123.123.123.123:3307. |
| Username | Your database username |
| Password | This user’s password |
If you use the MariaDB One-Click App, enter your VPS’s IP address as the server. This also works when both apps are running on the same VPS. The username and password are in the MariaDB app settings (gear icon), under App environment > Automatically generated values (SERVICE_USER_MARIADB and SERVICE_PASSWORD_MARIADB).
After logging in, you’ll see your databases on the left. The tabs along the top include SQL for running your own queries, as well as Export and Import for backups and SQL files.
The app accepts files up to 8 MB when importing. To import larger SQL files, add a custom UPLOAD_LIMIT variable in the app settings (gear icon), under App environment, for example, with the value 256M. After saving, the app restarts and the import page displays the new maximum.
- The login page is accessible to anyone who knows its address. Use secure database passwords. If you only need phpMyAdmin occasionally, stop the app from its card and start it again when needed.
- To install updates, go to the app settings (gear icon) > App update. Click Check for updates and, if a new version is available, click Apply update. Your databases are not affected because they are not stored in the app.
- You don’t need to back up the app itself. Instead, back up your databases, for example, by exporting them as described below under “Import and Export.”
The rest of this guide describes how to manually install phpMyAdmin with Apache and PHP using the command line, for example, on a dedicated server or a server that already has a web server running. The commands are for Debian and Ubuntu.
- A Linux server running Debian or Ubuntu with SSH access. If you’re not sure how to connect, see our guide First SSH Access.
- A MariaDB or MySQL database running on this server or accessible from it. For instructions on installing MariaDB, see How to Set Up Databases on a Linux Server.
- PHP version 7.2.5 or later. Current versions of Debian and Ubuntu include a suitable version. For more information about PHP, see our guide Install PHP.
- For HTTPS: a domain or subdomain with an A record pointing to your server’s IP address (e.g.
pma.example.com).
phpMyAdmin itself requires very little processing power. The following values are a good guideline for Apache, PHP, and phpMyAdmin; the database requires additional resources depending on its size:
| Hardware | Minimum | Recommended |
|---|---|---|
| CPU | 1 vCPU core | 2 vCPU cores |
| RAM | 512 MB | 1 GB |
| Storage | 1 GB | 5 GB |
First bring your system up to date, then install Apache, PHP, and the PHP extensions phpMyAdmin needs:
sudo apt update -y
sudo apt upgrade -y
sudo apt install -y apache2 php libapache2-mod-php php-mysql php-mbstring php-zip php-gd php-xml php-curl unzip wget
If the required PHP packages are missing, phpMyAdmin’s PHP files cannot be processed and displayed correctly. Without php-mysql, phpMyAdmin cannot connect to the database.
To make Apache accessible from the internet, open the ports for HTTP (80) and HTTPS (443) in the firewall. In this example, we use the UFW firewall, because Apache includes a dedicated profile for it. For more information about firewalls on Linux, see our guide Manage the Firewall.
sudo apt install -y ufw
sudo ufw allow OpenSSH
sudo ufw allow in "Apache Full"
sudo ufw enable
sudo ufw status
Make sure the SSH rule is in place before enabling UFW. Without it, you won’t be able to log in to the server over SSH if your connection is interrupted.
You don’t need to open database port 3306 for phpMyAdmin if the database is running on the same server: phpMyAdmin will connect locally.
Use the cd /usr/share command to go to the directory where you want to install phpMyAdmin. Then download the latest version of phpMyAdmin and extract it:
cd /usr/share
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -O phpmyadmin.zip
sudo unzip -q phpmyadmin.zip
Now rename the extracted archive to a simpler name, delete the ZIP file, and set the required permissions:
sudo mv phpMyAdmin-*-all-languages phpmyadmin
sudo rm phpmyadmin.zip
sudo chmod -R 0755 phpmyadmin
Next, add phpMyAdmin to the web server configuration. Create a new configuration file with sudo nano /etc/apache2/conf-available/phpmyadmin.conf and add the following contents:
Alias /phpmyadmin /usr/share/phpmyadmin
<Directory /usr/share/phpmyadmin>
Options SymLinksIfOwnerMatch
DirectoryIndex index.php
</Directory>
<Directory /usr/share/phpmyadmin/templates>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/libraries>
Require all denied
</Directory>
<Directory /usr/share/phpmyadmin/setup/lib>
Require all denied
</Directory>
Save the file with CTRL+X, confirm with Y, and press Enter. Then enable the configuration and reload Apache:
sudo a2enconf phpmyadmin
sudo systemctl reload apache2
phpMyAdmin needs a temporary directory that the web server can write to, as well as a secret key for login cookies. Without the key, phpMyAdmin displays a warning after you log in saying that a temporary key has been generated. Create both as follows:
sudo mkdir /usr/share/phpmyadmin/tmp/
sudo chown -R www-data:www-data /usr/share/phpmyadmin/tmp/
sudo cp /usr/share/phpmyadmin/config.sample.inc.php /usr/share/phpmyadmin/config.inc.php
sudo sed -i "s|^\$cfg\['blowfish_secret'\] = '';|\$cfg['blowfish_secret'] = '$(openssl rand -hex 16)';|" /usr/share/phpmyadmin/config.inc.php
The last command adds a random key with exactly 32 characters to the config.inc.php file. This file also contains all other phpMyAdmin settings, such as the database server (localhost by default).
Open http://SERVER_IP/phpmyadmin in your browser. You’ll see the phpMyAdmin login page. Sign in with one of your database users.
On Debian and Ubuntu, the root user can only log in to MariaDB from the command line by default (sudo mysql), not with a password. phpMyAdmin will then show “Access denied for user 'root'@'localhost'”. Instead, create a separate user with a password for phpMyAdmin, as described below under “Create a Database and User.”
After you log in, phpMyAdmin displays a notice at the bottom saying that the phpMyAdmin configuration storage is not fully configured. You only need it for additional features such as bookmarks or history; phpMyAdmin works without it.
Without HTTPS, your database username and password are sent over the internet unencrypted. First, add your domain to the Apache configuration: open /etc/apache2/sites-available/000-default.conf and add the line ServerName pma.example.com to the <VirtualHost *:80> block. Then use Certbot to get a free certificate from Let’s Encrypt:
sudo systemctl reload apache2
sudo apt install -y certbot python3-certbot-apache
sudo certbot --apache -d pma.example.com
Certbot automatically updates the Apache configuration, redirects HTTP to HTTPS, and renews the certificate. You can then access phpMyAdmin at https://pma.example.com/phpmyadmin. Learn more in our guides Set Up Certbot and Create an SSL Certificate.
Automated attacks constantly scan the internet for phpMyAdmin, usually at the /phpmyadmin path. Protect the interface further using one of the following methods.
Additional password (Basic Auth): The browser will ask for a separate username and password before showing the login page. Create a user:
sudo apt install -y apache2-utils
sudo htpasswd -c /etc/apache2/.htpasswd-phpmyadmin admin
Then add these four lines to the <Directory /usr/share/phpmyadmin> block in /etc/apache2/conf-available/phpmyadmin.conf and reload Apache with sudo systemctl reload apache2:
AuthType Basic
AuthName "phpMyAdmin"
AuthUserFile /etc/apache2/.htpasswd-phpmyadmin
Require valid-user
Allow only specific IP addresses: If you have a static IP address, add the line Require ip 203.0.113.10 with your IP address to the same block instead. Everyone else will see a “Forbidden” message.
Add $cfg['AllowRoot'] = false; to the end of config.inc.php to prevent logging in as root through phpMyAdmin. You can also choose a less obvious path than /phpmyadmin in the Alias. Find more tips for your server in Linux Security Tips.
phpMyAdmin itself does not store any data. Your databases and the config.inc.php file are what matter. Back up individual databases in phpMyAdmin by clicking Export, as described in the next section. For regular or large backups, the command line is more reliable:
mysqldump -u DB_USER -p --single-transaction DB_NAME > DB_NAME-$(date +%F).sql
Download your backups from the server regularly, for example, using SFTP. To restore a backup, import the file with mysql -u DB_USER -p DB_NAME < DB_NAME-DATE.sql.
Update Apache and PHP packages with sudo apt update && sudo apt upgrade. You installed phpMyAdmin from a ZIP file, so you’ll need to install new versions manually. Rename the old installation, download the new version, and copy over your configuration:
cd /usr/share
sudo mv phpmyadmin phpmyadmin-alt
sudo wget https://www.phpmyadmin.net/downloads/phpMyAdmin-latest-all-languages.zip -O phpmyadmin.zip
sudo unzip -q phpmyadmin.zip && sudo rm phpmyadmin.zip
sudo mv phpMyAdmin-*-all-languages phpmyadmin
sudo chmod -R 0755 phpmyadmin
sudo cp phpmyadmin-alt/config.inc.php phpmyadmin/
sudo mkdir phpmyadmin/tmp && sudo chown -R www-data:www-data phpmyadmin/tmp
Once you’ve confirmed that login works with the new version, remove the old directory with sudo rm -r /usr/share/phpmyadmin-alt. You can find the latest version and security notices at phpmyadmin.net.
These steps are the same for the One-Click App and the manual installation. phpMyAdmin displays the interface in your browser’s language; the terms below are from the German interface.
It’s best to create a separate database and user for each application, such as WordPress or a game server plugin. Here’s how to do both at once:
- Log in with a user who is allowed to create users, such as the user for your MariaDB app.
- Click User Accounts at the top, then click Add user account.
- Enter a username. Under Host name, select Local if only applications on the same server need access, or Any host (
%) if other servers also need to connect. - Set a secure password, for example, by clicking Generate password.
- Under Database for user account, select Create database with same name and grant all privileges.
- Click Go at the very bottom.
Leave the Global privileges section empty. The new user will then only be able to edit their own database. If your user doesn’t have permission to create users, as is the case with many hosting databases, you can only edit existing databases.
- Export: Select the database on the left and click Export at the top. Choose the Quick export method and the SQL format to get a file containing all tables and data, which you can import later.
- Import: Select the destination database on the left, click Import at the top, choose your
.sqlfile (or a.zipor.gzfile) under File to import, then click Go at the bottom. phpMyAdmin displays the maximum file size next to the file field.
If the SQL file contains tables that already exist in the destination database, the import will fail with an error or replace them, depending on whether the file contains DROP TABLE commands. Export the destination database before importing so you can restore it if needed.
PHP determines the maximum file size you can import. The default for a manual installation is 2 MB. Change these values in Apache’s PHP configuration. Find the PHP version in the path by running php -v (e.g. 8.4 on Debian 13 or 8.3 on Ubuntu 24.04):
sudo nano /etc/php/8.4/apache2/php.ini
Set these two values, then reload Apache with sudo systemctl reload apache2:
upload_max_filesize = 256M
post_max_size = 256M
For the One-Click App, increase the limit by setting the UPLOAD_LIMIT variable, as described above under “App Upload Limit.”
- It doesn’t include its own database: phpMyAdmin only manages MySQL and MariaDB servers that are already running. It does not support PostgreSQL or other databases.
- Very large dumps: Files of several hundred MB often fail in the browser because of time or memory limits. Import them from the command line with
mysql -u DB_USER -p DB_NAME < dump.sql. - It cannot exceed the database user’s privileges: phpMyAdmin can only do what the logged-in user is allowed to do in the database.
You’ve installed phpMyAdmin on your Linux server, secured it with HTTPS and additional access protection, and learned how to create databases and users, import and export data, and increase the upload limit. For instructions on setting up MariaDB itself, see How to Set Up MariaDB on a Linux Server.
Prefer not to use the command line? Choose the easy One-Click App method described above under “The Easy Way: phpMyAdmin as a One-Click App.”
