How to Install phpMyAdmin on CentOS Stream 9

phpMyAdmin is a free software tool written in PHP that is intended to handle the administration of a MySQL or MariaDB database server. You can use phpMyAdmin to perform most administration tasks, including creating a database, running queries, and adding user accounts. In this article, we are going to learn how to install phpMyAdmin on CentOS Stream 9. So, let’s get started.

Checkout the phpMyAdmin Project Here.

Try this wiki on our VPS. Starting at just $5/month with 24x7 In-house customer support.

Pre-requisites :

  • A system with CentOS Stream 9 installed and running.

  • root access to the system.

Once you're all set, we'll proceed with phpMyAdmin installation and configuration.

Install MariaDB Server

MariaDB is a popular database server. The installation is simple and requires just a few steps as shown.

dnf install mariadb-server mariadb -y

systemctl start mariadb

systemctl enable mariadb

systemctl status mariadb

Install phpMyAdmin

First, we install the EPEL (Extra Packages for Enterprise Linux) repository,

dnf config-manager --set-enabled crb

dnf install https://dl.fedoraproject.org/pub/epel/epel-release-latest-9.noarch.rpm

dnf install https://dl.fedoraproject.org/pub/epel/epel-next-release-latest-9.noarch.rpm

Finally, we install the phpMyAdmin package, Using the following command:

dnf install phpmyadmin

phpMyAdmin inserts it's own configuration into the Apache webserver (httpd), to load this new configuration we restart httpd,

systemctl restart httpd

Edit file phpMyAdmin.conf

vi /etc/httpd/conf.d/phpMyAdmin.conf

Add the "Require all granted" line under the "Require local" line

# dangerous unless properly secured by SSL

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
   AddDefaultCharset UTF-8
   Require local
   Require all granted
</Directory>

<Directory /usr/share/phpMyAdmin/setup/>
   Require local
</Directory>

Now, press the Esc key, and type in :wq! and press the Enter key to save and exit the file.

Enable Firewalld

Let's allow the firewall rules for http and https,

[root@vps ~]# firewall-cmd --add-service=http --permanent
success
[root@vps ~]# firewall-cmd --add-service=https --permanent
success
[root@vps ~]# firewall-cmd --reload
success
[root@vps ~]#

Now, restart & check the Apache with the following commands:

systemctl restart httpd

systemctl status httpd

Accessing phpMyAdmin

Now open the IP with /phpmyadmin from your browser, this will redirect you to the phpMyAdmin.

http://192.169.7.180/phpmyadmin

Replace the 192.169.7.180 with the actual IP or domain configured on the server.

Demo screenshot for phpMyadmin:

Now you have successfully installed phpMyAdmin on CentOS Stream 9.