Installation and configuration of PhpMyAdmin

From Thomas-Krenn-Wiki
Jump to navigation Jump to search

This article describes how to install, configure and secure the web-tool phpMyAdmin under Ubuntu 24.04 to administrate MariaDB/MySQL data bases via websurface.

Requirements

Installation is performed from the official Ubuntu package sources.

Installation of phpMyAdmin (Apache2)

The simplest installation is directly made with Apache2:

sudo apt update && sudo apt upgrade -y

sudo apt install phpmyadmin -y

The following options are requested during the setup:

  • select webserver » Apache2
  • configure data base for phpMyAdmin automatically with » Yes
  • set password for phpMyAdmin system user

After the installation, the phpMyAdmin is ready under:

http://SERVER-IP/phpmyadmin

You can log in with every existing data base user, for example:

  • root (if activated)
  • other SQL-user

verify PHP-extensions

phpMyAdmin requires some PHP-modules. If they are missing, you can reinstall them:

sudo apt install php-mysqli php-mbstring php-zip php-gd php-json php-curl

After this, you can restart the webserver:

sudo systemctl restart apache2

Secure phpMyAdmin

As phpMyAdmin is often the target for automatized attacks, the following measurements should at least be implemented:

sudo apt install php-mysqli php-mbstring php-zip php-gd php-json php-curl

After this, restart the webserver:

sudo systemctl restart apache2

1. change URL (Security by Obscurity)

sudo mv /usr/share/phpmyadmin /usr/share/webdb

Adjust Apache-Konfig, then:

sudo systemctl restart apache2

Call then, for example, at:

http://SERVER-IP/webdb

2. activate Fail2Ban (recommended)

See: SSH Login unter Debian mit fail2ban absichern

3. force HTTPS

Absolutely essential for productive environments.

Install Certbot:

sudo apt install certbot python3-certbot-apache -y sudo certbot --apache

Troubleshooting

  • 403 Forbidden
    • verify authorization of phpMyAdmin-config
  • Login does not function
    • verify database user rights
  • phpMyAdmin displays error
    • install PHP-module: php-mbstring php-zip php-gd php-json php-curl
  • 404 Not Found
    • verify Alias or Symlink (nginx/Apache)

Summary

You can install a functional phpMyAdmin under Ubuntu 24.04:

  • installation via package manager
  • configure webserver (Apache/nginx)
  • provide PHP-module
  • secure access
  • activate HTTPS

This provides a convenient web interface for managing MariaDB/MySQL databases.


Author: Adrian Zillner

Adrian Zillner has been working in Technical Service at Thomas-Krenn AG since May 2025. He is responsible for supporting customers and answering questions about technical issues.

Translator: Alina Ranzinger

Alina has been working at Thomas-Krenn.AG since 2024. After her training as multilingual business assistant, she got her job as assistant of the Product Management and is responsible for the translation of texts and for the organisation of the department.


Related articles

Linux Kernel Versions
Linux Performance Measurements using vmstat
SUSE Linux Enterprise Server (SLES) Version Information