How do I Install phpMyAdmin on RHEL / CentOS 8?. In this blog post, we will cover how to install and Configure phpMyAdmin on RHEL 8. phpMyAdmin is an open source software tool written in PHP for administering MySQL and MariaDB database servers from a Web interface.

phpMyAdmin has support for a wide range of operations on MySQL, MariaDB, and Drizzle. With this tool, you can manage databases, tables, columns, relations, indexes, users, permissions, and others through an intuitive and easy to use web interface.

For Ubuntu / Debian, refer to how to Install Latest phpMyAdmin on Ubuntu / Debian

Install and Configure phpMyAdmin on RHEL / CentOS 8

Below are the steps you’ll follow to install and configure phpMyAdmin on RHEL 8. The dependencies required are PHP, Apache Web Server and Database server to be managed.

Step 1: Install PHP

phpMyAdmin is written in PHP and you’ll need it installed on your RHEL server. We had written a comprehensive guide on installation of PHP on RHEL 8.

How to Install PHP on RHEL 8 / CentOS 8

Ensure php-mysqlnd extension is installed.

sudo yum -y install php-mysqlnd

Step 2: Install MariaDB/MySQL Database Server

The next step is to install the MariaDB/MySQL database server. Follow guides below to install MariaDB or MySQL on RHEL 8.

How to Install MySQL 8.0 on RHEL 8

How to Install MariaDB Database Server on RHEL 8

Step 3: Install Apache Web Server

phpMyAdmin support both Apache and Nginx as web server. We chose Apache httpd server because it is the most used Web server in enterprise and RHEL ecosystem.

Use our guide below to install Apache web server on RHEL 8.

How to Install Apache with mod_ssl & mod_http2 on RHEL 8

Step 4: Install phpMyAdmin on RHEL 8

Visit phpMyAdmin downloads page and check the latest available package.

Save version to variable.

DATA="$(wget -q -O-)"
URL="$(echo $DATA | cut -d ' ' -f 3)"
VER="$(echo $DATA | cut -d ' ' -f 1)"

The download the latest release as specified above.

curl -o phpMyAdmin-${VER}-all-languages.tar.gz${VER}/phpMyAdmin-${VER}-all-languages.tar.gz

For English language only package, use:

curl -o phpMyAdmin-${VER}-english.tar.gz${VER}/phpMyAdmin-${VER}-english.tar.gz

Extract downloaded Archive

$ tar xvf phpMyAdmin-${VER}-english.tar.gz
$ tar xvf phpMyAdmin-${VER}-all-languages.tar.gz

Move the folder to /usr/share/phpmyadmin.

rm phpMyAdmin-*.tar.g
sudo mv phpMyAdmin-*/ /usr/share/phpmyadmin

Create directory for phpMyAdmin temp files.

sudo mkdir -p /var/lib/phpmyadmin/tmp
sudo chown -R apache:apache /var/lib/phpmyadmin

Create directory for phpMyAdmin configuration files such as htpass file.

sudo mkdir /etc/phpmyadmin/

Create phpMyAdmin configuration file.

sudo cp /usr/share/phpmyadmin/  /usr/share/phpmyadmin/

Edit the file

sudo vim /usr/share/phpmyadmin/

Set a secret passphrase – Needs to be 32 chars long

$cfg['blowfish_secret'] = 'H2OxcGXxflSd8JwrwVlh6KW6s2rER63i'; 

Configure Temp directory

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

Step 5: Configure Apache web Server

Create phpMyAdmin Apache configuration file.

sudo vim /etc/httpd/conf.d/phpmyadmin.conf

Add below data:

# Apache configuration for phpMyAdmin
Alias /phpMyAdmin /usr/share/phpmyadmin/
Alias /phpmyadmin /usr/share/phpmyadmin/
<Directory /usr/share/phpmyadmin/>
   AddDefaultCharset UTF-8
   <IfModule mod_authz_core.c>
     # Apache 2.4
     Require all granted
   <IfModule !mod_authz_core.c>
     # Apache 2.2
     Order Deny,Allow
     Deny from All
     Allow from
     Allow from ::1

You can restrict access from specific IP by adding line like below

Require ip

Validate Apache configuration.

$ sudo apachectl configtest
Syntax OK

Restart httpd service to load new configuration,

sudo systemctl restart httpd

Step 5: Configure SELinux and Firewall

If you have SELinux in Enforcing mode, you’ll get Permission denied error when you try to access phpMyAdmin page. Allow httpd to serve content in the phpmyadmin directory.

sudo semanage fcontext -a -t httpd_sys_content_t "/usr/share/phpmyadmin(/.*)?"

Apply the policy by running the command.

sudo restorecon -Rv /usr/share/phpmyadmin

Allow http port in the firewall.

sudo firewall-cmd --add-service=http --permanent

Reload firewall reload configuration.

sudo firewall-cmd --reload

Step 6: Access phpMyAdmin Web interface on RHEL 8

Open the URL http://[ServerIP|Hostname]/phpmyadmin

install phpmyadmin rhel8 login

Login to phpMyAdmin dashboard with your Database credentials – username & password.

install phpmyadmin rhel8 dashboard

Congratulations!. You have successfully installed phpMyAdmin on RHEL 8.

Check below web and PHP mastery courses:

Enjoy administering MySQL/MariaDB database operations from a web dashboard. You can also check:

Install MyWebSQL on RHEL 8 / CentOS 8

Other interesting guides:

Monitoring MySQL / MariaDB with Prometheus in five minutes

Install Docker and Docker Compose on RHEL 8

How to Install Netdata on RHEL 8

Your support is our everlasting motivation,
that cup of coffee is what keeps us going!

As we continue to grow, we would wish to reach and impact more people who visit and take advantage of the guides we have on our blog. This is a big task for us and we are so far extremely grateful for the kind people who have shown amazing support for our work over the time we have been online.

Thank You for your support as we work to give you the best of guides and articles. Click below to buy us a coffee.


Please enter your comment!
Please enter your name here