How to Install phpMyAdmin on Debian 11 Bullseye (Apache)

Have a look at the commands in this tutorial for the installation of PhpMyAdmin on Debian 11 Bullseye using Apache webserver. 

PhpMyAdmin is an open-source web-based application that offers a web interface to directly manage and access MySQL or MariaDB databases from anywhere/remotely using a web browser. The user can use the web graphical user interface provided by it to interact with databases without having extensive knowledge of the commands. Hence, even a newbie with some knowledge of computers can manage database tables for querying data and manipulating individual parameters.

Well, like any other popular CMS platform such as WordPress, PhpMyAdmin is also written in PHP programming language used to create dynamic websites by calling up various scripts. This allows the users to not only easily install PhpMyAdmin but also access it locally and remotely. The web interface uses the combination of user and password to authenticate the user – two-factor authentication can increase security.

With this tool, numerous procedures can be carried out using a convenient interface that would otherwise have to be carried out by an administrator using a command line with text input.


Steps to install phpMyAdmin on Debian 11 Bullseye

1. Update your server/desktop

If your Debian 11 server is already up to date then leave this step; otherwise, it is recommended to run one of the system update commands to not only get the latest version of the already installed packages but also refresh the system repository cache along with some needed tools.

sudo apt udpate
sudo apt install nano wget


2. Install Apache, PHP & MariaDB

Well, phpMyAdmin requires Apache webserver to get served over web browser using the local or internet network. Hence, we need to install the same on your Debian 11 server.

sudo apt install apache2

Start and enable and check the status of the webserver.

sudo systemctl enable --now apache2

to check the status:

systemctl status apache2

Install PHP

As phpMyAdmin is based on PHP, hence we need to install it along with common extensions.

sudo apt install php php-json

Install Database

If you already have a database installed on your Debian 11 server where you are installing phpMyAdmin or you have a Database on any other server which you want to manage using phpMyAdmin then leave these steps otherwise install MariaDB/MySQL.

sudo apt install mariadb-server

Start and enable:

sudo systemctl enable --now mariadb

Check Status:

systemctl status mariadb

Secure Database server:

Once the installation is completed, run the given command to secure your database server.

sudo mysql_secure_installation

Go through the guided text-based wizard to secure the MariaDB/MySQL.


3. Create Database User for phpMyAdmin on Debian 11

Although it is not necessary to create a separate user to access with phpMyAdmin, however, it is recommended to improve the overall security, moreover, after disabling the remote root login, we have to create a new user to access all databases.

sudo mysql
CREATE USER 'user'@localhost IDENTIFIED BY 'password';
GRANT ALL PRIVILEGES ON *.* TO 'user'@localhost IDENTIFIED BY 'password';

Note: Replace user and password with whatever you want to set.


4. Download the latest phpMyAdmin package

Although we can install PHPMyAdmin directly using the default repository of Debian 11 Bullseye, however, the version will be old. Hence to get the latest one, download its archive file manually using the given command:



5. Configure phpMyAdmin on Debian 11 Bullseye

Once you have the zipped phpMyAdmin file on your server or system, create some required directories and move the file to an appropriate location for accessing it through the Apache webserver.

sudo tar xvf phpMyAdmin-latest-all-languages.tar.gz
sudo mv phpMyAdmin-*-all-languages/ /var/www/html/phpmyadmin

Now, create a configuration file by copying the one already present in the phpMyAdmin folder;

cd /var/www/html

sudo cp phpmyadmin/ phpmyadmin/

Also create a Temporary folder for storage, if not exist.

sudo mkdir /var/www/html/phpmyadmin/tmp


Generate a secret key to use with phpMyadmin:

openssl rand -base64 32

Copy the generated key for cookie authentication.

Now, edit the phpMyAdmin configuration file

sudo nano /var/www/html/phpmyadmin/

and past it in the front of line :

$cfg[‘blowfish_secret’] = ‘your-key‘; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Replace your key with the generated one.

Add cute fish bowl key in phpMyADmin Debian 11

Also, scroll down and add this line.

$cfg['TempDir'] = '/var/www/html/phpmyadmin/tmp';


Create Temp storage file for PhpMyAdmin

After all, this, Save the file by pressing Ctrl+O, hit the Enter key, and then Ctrl+X to exit.


Change file permissions:

Given access to Apache user to read the files:

sudo chown -R www-data:www-data /var/www/html/phpmyadmin


Create Apache configuration file

sudo nano /etc/apache2/conf-available/phpmyadmin.conf

Copy Paste the following lines:

Alias /phpmyadmin /var/www/html/phpmyadmin

<Directory /var/www/html/phpmyadmin/>
   AddDefaultCharset UTF-8
   <IfModule mod_authz_core.c>
      Require all granted

<Directory /var/www/html/phpmyadmin/setup/>
   <IfModule mod_authz_core.c>
       Require all granted

Activate new configuration:

sudo a2enconf phpmyadmin.conf


Restart the Apache Webserver

To make the changes apply successfully, restart the Apache webserver.

sudo systemctl restart apache2


6. Access web interface

Enter the server IP address or domain name along with /phpmyadmin folder in the browser URL to access this web database management platform.

For example:



Note: If you get this notification-  The phpMyAdmin configuration storage is not completely configured, some extended features have been deactivated. Find out why. Or alternately go to the ‘Operations’ tab of any database to set it up there.

Then simply click on the Find out why link and click the “Create” link to automatically create phpmyadmin database.

PHPMYADMIn installation on Debian 11 Bullseye



One Response

  1. Anthony Scicluna December 30, 2021

Leave a Reply

This site uses Akismet to reduce spam. Learn how your comment data is processed.