Install phpMyAdmin on Rocky Linux 9 [Step-by-Step]

Rocky Linux

Author: Omer Cakmak
Reviewer: Deepak Prasad

phpMyAdmin is an open source database management tool. You can manage MySQL and MariaDB databases via the web browser.  In this article, we will explain the topic "How to install phpMyAdmin on Rocky Linux 9".


Install phpMyAdmin on Rocky Linux 9

If you do not have a database (MariaDB, MySQL) installed before, you can get help using Install MariaDB on Rocky Linux We will explain the installation in 2 ways. Each method has added benefits to the phpMyAdmin installation. The first method provides ease of installation, while the second method provides an up-to-date use of phpMyAdmin.


Method -1- Installation from EPEL repository

Step-1: Install EPEL Repo

In Redhat based systems (Rocky Linux, Centos, AlmaLinux) the phpMyAdmin package is in the EPEL repo. Let's add the epel repository system:

[root@rocky9 foc]# dnf -y install epel-release


Step-2: Install phpMyAdmin package

Let's install the phpMyAdmin package from the epel repository:

[root@rocky9 foc]# dnf -y install phpmyadmin


Step-3: Enable Firewalld

Let's enter the firewall rules for http and https:

[root@rocky9 foc]# firewall-cmd --add-service=http --permanent
[root@rocky9 foc]# firewall-cmd --add-service=https --permanent
[root@rocky9 foc]# firewall-cmd --reload
We have disabled our SELinux in this method.


Step-4: Enable and Start HTTPD Service

Let's start and enable the httpd service:

[root@rocky9 foc]# systemctl enable httpd --now
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/httpd.service.


Step-5: Configure phpMyAdmin.conf

For remote access we have to make some changes in /etc/httpd/conf.d/phpMyAdmin.conf file. Let's add the third line by closing the first 2 lines below. When these lines remain as standard, it creates a security vulnerability. You can define an alias instead of pma.

#Alias /phpMyAdmin /usr/share/phpMyAdmin
#Alias /phpmyadmin /usr/share/phpMyAdmin
Alias /pma /usr/share/phpMyAdmin

Add "Require all granted" line under "Require local" line. For example:

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

Finally, the httpd service is restarted:

[root@rocky9 foc]# systemctl restart httpd


Step-6: Access phpMyAdmin GUI

You can now access phpMyAdmin by typing http://server_ip_adress/pma in the web browser(In our example:

Enter the username and password of your MySQL root user to access all the databases.

Install phpMyAdmin on Rocky Linux 9 [Step-by-Step]


Method -2- Installation using official archive

Step-1: Install pre-requisite packages

First, let's install the necessary packages:

[root@rocky9 foc]# dnf -y install php php-pdo php-pecl-zip php-json php-mbstring php-mysqlnd httpd wget unzip


Step-2: Download phpMyAdmin archive

Then go to with a web browser for the phpMyAdmin version you want to download. Select the version from the list on the screen. Right click and copy the address. Start the download process by typing the link we received after the wget command in the terminal:

[root@rocky9 tmp]# wget
--2022-09-19 23:48:34--
Resolving (,,, ...
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 14112668 (13M) [application/zip]
Saving to: ‘’

phpMyAdmin-5.2.0-all-language 100%[===============================================>] 13.46M 1.86MB/s in 5.8s

2022-09-19 23:48:40 (2.31 MB/s) - ‘’ saved [14112668/14112668]

Unzip the downloaded zip file:

[root@rocky9 tmp]# unzip

Move the file under /usr/share/:

[root@rocky9 tmp]# mv phpMyAdmin-5.2.0-all-languages /usr/share/phpmyadmin


Step-3: Enable Remote Access

Create the phpmyadmin.conf file for remote access:

[root@rocky9 tmp]# vi /etc/httpd/conf.d/phpmyadmin.conf

and write the following lines in this file:

Alias /pmaadmin /usr/share/phpmyadmin

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

Create tmp directory for phpmyadmin, give necessary permissions to this tmp directory and phpmyadmin directory:

[root@rocky9 foc]# mkdir /usr/share/phpmyadmin/tmp
[root@rocky9 foc]# chown -R apache:apache /usr/share/phpmyadmin
[root@rocky9 foc]# chmod 777 /usr/share/phpmyadmin/tmp


Step-4: Enable SELinux

Enable SELinux and set permissions:

[root@rocky9 foc]# chcon -Rv --type=httpd_sys_content_t /usr/share/phpmyadmin/*

Start the http service:

[root@rocky9 foc]# systemctl start httpd.service


Step-5: Start HTTPD Service

Enable the http service:

[root@rocky9 foc]# systemctl enable httpd.service
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/httpd.service.


Step-6: Allow Firewalld

Finally, give firewall permissions:

[root@rocky9 foc]# firewall-cmd --add-service=http --permanent
[root@rocky9 foc]# firewall-cmd --add-service=https --permanent
[root@rocky9 foc]# firewall-cmd --reload


Step-7: Access phpMyAdmin GUI

You can access phpMyAdmin by typing http://server_ip_address/pmadmin in the web browser. In our example: we accessed

Install phpMyAdmin on Rocky Linux 9 [Step-by-Step]


Note that you cannot go further than the above screens when there is no database in the system. If there is a database, you can see it on the left of the screen after login.

Install phpMyAdmin on Rocky Linux 9 [Step-by-Step]

Install phpMyAdmin on Rocky Linux 9 [Step-by-Step]



This article explained how to install phpMyadmin  on Rocky Linux 9 with 2 methods. You can get help from the "Install MariaDB on Rocky Linux 8.4 [Step-by-Step]" article for MariaDB database setup.


References - Bringing MySQL to the web - How to Install phpMyAdmin on Rocky Linux 8


Views: 630
Omer Cakmak

Omer Cakmak

He is highly skilled at managing Debian, Ubuntu, CentOS, Oracle Linux, and Red Hat servers. Proficient in bash scripting, Ansible, and AWX central server management, he handles server operations on OpenStack, KVM, Proxmox, and VMware. You can connect with him on his LinkedIn profile.

Can't find what you're searching for? Let us assist you.

Enter your query below, and we'll provide instant results tailored to your needs.

If my articles on GoLinuxCloud has helped you, kindly consider buying me a coffee as a token of appreciation.

Buy GoLinuxCloud a Coffee

For any other feedbacks or questions you can send mail to

Thank You for your support!!

Leave a Comment