How to Install PhpMyAdmin on Debian 11.4.0

To Install PhpMyAdmin On Linux Debian 11.4.0

Introduction:

PhpMyAdmin is a free and open-source administration tool for MySQL and MariaDB. In addition to being a portable web application written primarily in PHP, it has become one of the most popular MySQL administration tools, particularly for web hosting services.

Installation Steps:

Step 1: Check the Version of Debian Linux by using the below command

root@debian:~# lsb_release -a
No LSB modules are available.
Distributor ID: Debian
Description:   Debian GNU/Linux 11 (bullseye)
Release:  11
Codename: bullseye

Step 2: Update server packages to latest version by using the below command

root@debian:~# apt update
Hit:1 http://security.debian.org/debian-security bullseye-security InRelease
Hit:2 http://deb.debian.org/debian bullseye-updates InRelease
Hit:3 http://deb.debian.org/debian bullseye InRelease
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
All packages are up to date.

Step 3: Install Phpadmin by using the below command

root@debian:~# apt install phpmyadmin -y
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
The following package was automatically installed and is no longer required:
  libopengl0
Use 'apt autoremove' to remove it.
The following additional packages will be installed:
  php-bz2 php-curl php-gd php-google-recaptcha php-mariadb-mysql-kbs php-mbstring
  php-mysql php-phpmyadmin-motranslator php-phpmyadmin-shapefile
  php-phpmyadmin-sql-parser php-phpseclib php-psr-cache php-psr-container
  php-psr-log php-symfony-cache php-symfony-cache-contracts php-symfony-config
  php-symfony-dependency-injection php-symfony-expression-language
  php-symfony-filesystem php-symfony-service-contracts php-symfony-var-exporter
  php-symfony-yaml php-tcpdf php-twig php-twig-i18n-extension php-xml php-zip
  php7.4-bz2 php7.4-curl php7.4-gd php7.4-mbstring php7.4-mysql php7.4-xml
  php7.4-zip
Suggested packages:
  php-dbase php-libsodium php-mcrypt php-gmp php-symfony-finder
  php-symfony-proxy-manager-bridge php-symfony-console php-imagick php-twig-doc
  php-recode php-gd2 php-pragmarx-google2fa-qrcode php-samyoul-u2f-php-server
Recommended packages:
  php-mcrypt
The following NEW packages will be installed:
  php-bz2 php-curl php-gd php-google-recaptcha php-mariadb-mysql-kbs php-mbstring
  php-mysql php-phpmyadmin-motranslator php-phpmyadmin-shapefile
  php-phpmyadmin-sql-parser php-phpseclib php-psr-cache php-psr-container
  php-psr-log php-symfony-cache php-symfony-cache-contracts php-symfony-config
  php-symfony-dependency-injection php-symfony-expression-language
  php-symfony-filesystem php-symfony-service-contracts php-symfony-var-exporter
  php-symfony-yaml php-tcpdf php-twig php-twig-i18n-extension php-xml php-zip
  php7.4-bz2 php7.4-curl php7.4-gd php7.4-mbstring php7.4-mysql php7.4-xml
  php7.4-zip phpmyadmin
0 upgraded, 36 newly installed, 0 to remove and 0 not upgraded.

Step 4: Login into MySQL Database root by using the below command

root@debian:~# mysql
Welcome to the MariaDB monitor.  Commands end with ; or \g.
Your MariaDB connection id is 55
Server version: 10.5.19-MariaDB-0+deb11u2 Debian 11

Copyright (c) 2000, 2018, Oracle, MariaDB Corporation Ab and others.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

MariaDB [(none)]>

Step 5: List the Database by using the below command

MariaDB [(none)]> show databases;
+--------------------+
| Database           |
+--------------------+
| information_schema |
| mysql              |
| performance_schema |
| phpmyadmin         |
+--------------------+
4 rows in set (0.001 sec)

Step 6: Change the Database to PhpMyAdmin by using the below command

MariaDB [(none)]> use phpmyadmin;
Reading table information for completion of table and column names
You can turn off this feature to get a quicker startup with -A

Database changed

Step 7: Create User and Password for PhpMyAdmin by using the below command

MariaDB [phpmyadmin]> create user user@localhost identified by 'Linuxc#4';
Query OK, 0 rows affected (0.001 sec)

Step 8: Grant all Permissions by using following commands

MariaDB [phpmyadmin]> grant all on phpmyadmin.* to user@localhost;
Query OK, 0 rows affected (0.001 sec)

Step 9: Give Privileges by using the below command

MariaDB [phpmyadmin]> flush privileges;
Query OK, 0 rows affected (0.001 sec)

Step 10: Exit the MySQL database by using the below command

MariaDB [phpmyadmin]> exit
Bye

Step 11: Restart the apache by using the below command.

root@debian:~# systemctl restart apache2

Step 12: Install Phpadmin Dependency Package by using the below command

root@debian:~# apt install php7.4-mysqli
Reading package lists... Done
Building dependency tree... Done
Reading state information... Done
Note, selecting 'php7.4-mysql' instead of 'php7.4-mysqli'
php7.4-mysql is already the newest version (7.4.33-1+deb11u4).
php7.4-mysql set to manually installed.
The following package was automatically installed and is no longer required:
  libopengl0
Use 'apt autoremove' to remove it.
0 upgraded, 0 newly installed, 0 to remove and 0 not upgraded.

Step 13: Restart the apache by using the below command.

root@debian:~# systemctl restart apache2

Conclusion:

We have reached the end of this article. In this guide, we have walked you through the steps required to install phpMyAdmin on Linux Debian 11.4.0. Your feedback is much welcome

FAQ
Q
What is the command to grant all the permissions in phpMyAdmin?
A
The command to grant permission in phpMyAdmin use grant all on phpmyadmin.* to user@localhost;
Q
How to create the user and the password for phpMyAdmin in MySQL?
A
To create a user and the password for phpMyAdmin in MySQL use the command create user user@localhost identified by '123456';
Q
How will you log in to MariaDB?
A
To login into the MariaDB use the command mysql -u root -p
Q
What are all the required repositories in phpMyAdmin?
A
The target system is updated with the required repositories. Install the LAMP server in the target system and press y to continue the installation process.# apt-get install apache2 mysql-server php
Q
How to install the phpMyAdmin package on Debian?
A
apt install phpmyadmin -y