Share on Social Media

Learn how to install phpMyAdmin on Rocky Linux 8 with this step-by-step guide. Easily manage your MySQL databases through a web interface by following our detailed instructions. #centlinux #linux #mysql

What is phpMyAdmin?

phpMyAdmin is a free, open-source web-based tool written in PHP that is used to manage MySQL and MariaDB databases. It provides an easy-to-use graphical interface, allowing users to perform various database management tasks without needing to write SQL commands directly. Here are some key features and functionalities of phpMyAdmin:

  1. User-Friendly Interface: Offers an intuitive web interface for managing databases, tables, columns, relations, indexes, users, permissions, and more.
  2. Database Management: Allows users to create, modify, and delete databases and their components, such as tables, fields, and indexes.
  3. SQL Execution: Enables the execution of SQL queries, including complex queries, through an interactive interface.
  4. Data Import/Export: Supports importing data from CSV, SQL, and other formats, and exporting data to various formats like CSV, SQL, XML, and more.
  5. Backup and Restore: Provides tools for creating database backups and restoring data from backups, ensuring data integrity and security.
  6. User Management: Facilitates the creation and management of database users and their permissions, enhancing security and access control.
  7. Database Optimization: Includes features for optimizing database performance, such as repairing and analyzing tables.
  8. Multilingual Support: Available in multiple languages, making it accessible to a global audience.
  9. Extensions and Plugins: Supports various extensions and plugins to extend its functionality and integrate with other tools and platforms.

phpMyAdmin is widely used by developers, database administrators, and anyone who needs to manage MySQL or MariaDB databases due to its ease of use, robust feature set, and flexibility.

Recommended Book: Mastering phpMyAdmin 3.4 for Effective MySQL Management (PAID LINK)
Recommended Online Training: SQL: Master SQL With PhpMyAdmin and MYSQL Engine

2686550 a0a2 3show?id=oLRJ54lcVEg&offerid=1486687.391977027109908647630551&bids=1486687

phpMyAdmin Alternatives

There are several alternatives to phpMyAdmin for managing MySQL and MariaDB databases. Some popular alternatives include:

  1. Adminer: A lightweight, user-friendly database management tool written in PHP. Adminer provides a similar interface to phpMyAdmin but with a smaller footprint and simpler design.
  2. DBeaver: A universal database tool that supports multiple database management systems, including MySQL, PostgreSQL, SQLite, and more. DBeaver offers a rich set of features for database development, administration, and analysis.
  3. HeidiSQL: A powerful SQL client for Windows that allows users to manage MySQL, MariaDB, and Microsoft SQL Server databases. HeidiSQL offers a user-friendly interface with features like syntax highlighting, code completion, and data browsing.
  4. MySQL Workbench: An official graphical tool provided by MySQL for database development, administration, and management. MySQL Workbench offers features like SQL development, data modeling, server administration, and database migration.
  5. Navicat: A comprehensive database management and development tool that supports multiple database systems, including MySQL, PostgreSQL, Oracle, SQL Server, and more. Navicat provides a wide range of features for database design, administration, and maintenance.

These alternatives offer different features, interfaces, and capabilities, so you can choose the one that best fits your requirements and preferences.

Environment Specification

We are using the same Linux virtual machine, where we have installed MariaDB database server in our previous article. Virtual machine specifications are:

  • CPU – 3.4 Ghz (2 cores)
  • Memory – 2 GB
  • Storage – 20 GB
  • Operating System – Rocky Linux 8.5 (Green Obsidian)
  • Hostname –
  • IP Address – /24

Update your Rocky Linux Server

By using a SSH client software, login to as root user.

Rebuild cache of installed yum repositories.

# dnf makecache
MariaDB                                         1.5 kB/s | 3.4 kB     00:02
Rocky Linux 8 - AppStream                       434 kB/s | 9.7 MB     00:22
Rocky Linux 8 - BaseOS                          647 kB/s | 6.8 MB     00:10
Rocky Linux 8 - Extras                          3.6 kB/s |  12 kB     00:03
Metadata cache created.

Execute following command to update your Rocky Linux server.

# dnf update -y
Last metadata expiration check: 0:00:59 ago on Thu 14 Apr 2022 10:49:04 PM PKT.
Dependencies resolved.
Nothing to do.

Check the Linux Operating System and Kernel versions as follows.

# cat /etc/rocky-release && uname -r
Rocky Linux release 8.5 (Green Obsidian)

Install Apache & PHP on Rocky Linux 8

phpMyAdmin is PHP based web application, therefore, you are required to install a PHP supported web server to deploy phpMyAdmin software.

You can install Apache HTTP server on your Linux machine as follows.

# dnf install -y @httpd

You are also required to install PHP support on your web server.

Check the available PHP modules in your enabled yum repositories.

# dnf module list php
Last metadata expiration check: 0:02:04 ago on Thu 14 Apr 2022 10:49:04 PM PKT.
Rocky Linux 8 - AppStream
Name      Stream       Profiles                       Summary
php       7.2 [d]      common [d], devel, minimal     PHP scripting language
php       7.3          common [d], devel, minimal     PHP scripting language
php       7.4          common [d], devel, minimal     PHP scripting language

Hint: [d]efault, [e]nabled, [x]disabled, [i]nstalled

We are installing phpMyAdmin 5.1.3 that requires PHP 7.1.3 or later.

Therefore, you may install PHP 7.4 on your Rocky Linux server.

# dnf module install php:7.4

Install necessary PHP packages in one single dnf statement as follows.

# dnf install -y php-common php-opcache php-cli php-gd php-curl php-mysqlnd php-xml wget policycoreutils-python-utils

Enable and start Apache and PHP services.

# systemctl enable --now httpd.service php-fpm.service
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/httpd.service.
Created symlink /etc/systemd/system/ → /usr/lib/systemd/system/php-fpm.service.

We will use the HTTPS port for better security in this article. Therefore, you have to allow the HTTPS in Linux firewall.

# firewall-cmd --permanent --add-service=https
# firewall-cmd --reload

How to install phpMyAdmin on Rocky Linux 8

phpMyAdmin is free and open source software, thus can be downloaded from their official website.

At the time of writing this article, phpMyAdmin 5.1.3 is the stable release available to download. Therefore, copy the URL of the phpMyAdmin software and use wget command to download it straight from Linux command line.

# cd /tmp
# wget
--2022-04-14 23:13:01--
Resolving (, 2a02:6ea0:e100::7
Connecting to (||:443... connected.
HTTP request sent, awaiting response... 200 OK
Length: 7560234 (7.2M) [application/octet-stream]
Saving to: ‘phpMyAdmin-5.1.3-english.tar.gz’

phpMyAdmin-5.1.3-en 100%[===================>]   7.21M  1.21MB/s    in 6.6s

2022-04-14 23:13:09 (1.09 MB/s) - ‘phpMyAdmin-5.1.3-english.tar.gz’ saved [7560234/7560234]

By using tar command, extract downloaded zip file in Apache’s document root directory.

# tar xvf phpMyAdmin-5.1.3-english.tar.gz --directory /var/www/html

Rename the extracted directory to a simple name for easy accessibility.

# cd
# mv /var/www/html/phpMyAdmin-5.1.3-english/ /var/www/html/pma

phpMyAdmin software provides a SQL script to create it’s repository in MySQL database.

You can execute this script as follows.

# mysql -u root -p < /var/www/html/pma/sql/create_tables.sql
Enter password:

Create a copy of phpMyAdmin configuration file to customize it according to your requirements.

# cp /var/www/html/pma/ /var/www/html/pma/

Open phpMyAdmin configuration file in vim text editor.

# vi /var/www/html/pma/

Find and set following directive in this file.

$cfg['blowfish_secret'] = 'I;Am;Fan;0f;0p3n;S0urc3;S0ftwar3'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

Create a temporary directory to cache templates by phpMyAdmin.

# mkdir /var/www/html/pma/tmp

Set apache user as owner of phpMyAdmin software directory.

# chown -R apache:apache /var/www/html/pma/

Set SELinux permissions for tmp directory, to make it writable by the apache user.

# semanage fcontext -a -t httpd_sys_rw_content_t "/var/www/html/pma/tmp(/.*)?"
# restorecon -Rv /var/www/html/pma/tmp
Relabeled /var/www/html/pma/tmp from unconfined_u:object_r:httpd_sys_content_t:s0 to unconfined_u:object_r:httpd_sys_rw_content_t:s0

Create an admin user for phpMyAdmin.

# mysql -u root -p
Enter password:
Welcome to the MariaDB monitor.  Commands end with ; or g.
Your MariaDB connection id is 25
Server version: 10.8.2-MariaDB MariaDB Server

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)]> CREATE USER ahmer@localhost IDENTIFIED BY 'pma';

MariaDB [(none)]> GRANT ALL ON *.* TO ahmer@localhost;


Open URL in a web browser.

phpMyAdmin Login
phpMyAdmin Login

Login as MySQL admin user.

phpMyAdmin Dashboard
phpMyAdmin Dashboard

Final Thoughts

Installing phpMyAdmin on Rocky Linux 8 opens up a convenient way to manage your MySQL and MariaDB databases through a user-friendly web interface. With our comprehensive guide, you’ll be able to set up phpMyAdmin quickly and efficiently, empowering you to streamline your database management tasks.

If you need further assistance with installing phpMyAdmin on Rocky Linux 8 or have other Linux-related needs, consider leveraging my expertise through my services on Fiverr. Visit my Fiverr profile here to explore how I can help you with installation support, system configuration, troubleshooting, and more. Let’s simplify your Linux experience together.

2 thoughts on “How to install phpMyAdmin on Rocky Linux 8”

Leave a Reply