Install phpMyAdmin on Debian 10

phpMyAdmin is a free and open-source web-based database management tool written in PHP. It provides a graphical web interface for users to manage MySQL or MariaDB database. Installing phpMyAdmin in Debian 10 is not easy when compared to Ubuntu and its derivates, because unlike ubuntu Debian 10 hasn't included phpMyAdmin in the software repository. So we have to install it manually.

Updating APT Package Repository Cache:

First, update the APT package repository cache with the following command

sudo apt update

Installing and Configuring MariaDB:

Now, install MariaDB server and client packages from the official package repository of Debian 10 with the following command:

sudo apt install mariadb-server mariadb-client

Set a root password for MariaDB:

sudo mysql_secure_installation

Installing Apache Web Server, PHP, and Required PHP Libraries:

Install Apache 2 web server, PHP and all the required PHP libraries with the following command

sudo apt install apache2 php php-json php-mbstring php-zip php-gd php-xml php-curl php-mysql

Downloading phpMyAdmin:

You can download the latest phpMyAdmin from the official website of phpMyAdmin. Once the page loads, click on the Download and copy the link location

sudo wget

Just List, whether phpMyAdmin zip file has downloaded to the home directory


Now, extract the phpMyAdmin archive in the /opt directory with the following command:

sudo unzip -d /opt

To see the phpMyAdmin directory is created in the /opt directory.

ls -lh /opt

For the sake of simplicity, rename the directory to just phpMyAdmin/ with the following command:

sudo mv -v /opt/phpMyAdmin-5.1.1-all-languages /opt/phpMyAdmin

Now, change the owner and group of the /opt/phpMyAdmin directory and all the contents of the directory to www-data.

sudo chown -Rfv www-data:www-data /opt/phpMyAdmin

The owner and group of the /opt/phpMyAdmin directory and contents of the directory should be changed to www-data.

Configuring Apache for phpMyAdmin:

Now, we have to configure the Apache webserver in order to use phpMyAdmin. I am going to configure phpMyAdmin on port 80 in this article. ( You can assign different port if you want)

First, create a new site configuration file for phpMyAdmin with the following command:

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

Now, add in the following lines to the PHPMyAdmin.conf file.

<VirtualHost *:8002>
ServerAdmin webmaster@localhost
DocumentRoot /opt/phpMyAdmin

<Directory /opt/phpMyAdmin>
Options Indexes FollowSymLinks
AllowOverride none
Require all granted
ErrorLog ${APACHE_LOG_DIR}/error_phpmyadmin.log
CustomLog ${APACHE_LOG_DIR}/access_phpmyadmin.log combined

save the file

If you are assigning port like 8002, you have to tell the Apache web server to listen to the port 8002.

To do that, edit the /etc/apache2/ports.conf configuration file with the following command:

sudo nano /etc/apache2/ports.conf

Now, add the line “Listen 8002” and save the file.

Enable the phpMyAdmin site that we’ve just configured with the following command:

sudo a2ensite phpmyadmin.conf

Restart the Apache webserver with the following command:

sudo systemctl reload apache2 && sudo systemctl restart apache2

Accessing phpMyAdmin:

You should be able to access phpMyAdmin on port with default port 80 or the port you have assigned like 8000.

From a browser, visit http://localhost:80 or http://localhost:8002 and you should see the login page of phpMyAdmin with MariaDB root user and root password.

Fix The configuration file now needs a secret passphrase (blowfish_secret)

You’ll see this error after every installation of PHPMyAdmin. To resolve this issue, just open ( or rename to if you haven’t done so yet ) and change this line

Navigate to phpMyAdmin directory

cd /opt/phpMyAdmin/

Rename to

sudo mv

Replace the red line to the blue line in config.php

sudo vim /opt/phpMyAdmin/

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */


$cfg['blowfish_secret'] = '0a;L}L260V/5NLeOWQg7mZKb[B7EGQZH';


0 Komentar