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
Table of Contents
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:
- User-Friendly Interface: Offers an intuitive web interface for managing databases, tables, columns, relations, indexes, users, permissions, and more.
- Database Management: Allows users to create, modify, and delete databases and their components, such as tables, fields, and indexes.
- SQL Execution: Enables the execution of SQL queries, including complex queries, through an interactive interface.
- Data Import/Export: Supports importing data from CSV, SQL, and other formats, and exporting data to various formats like CSV, SQL, XML, and more.
- Backup and Restore: Provides tools for creating database backups and restoring data from backups, ensuring data integrity and security.
- User Management: Facilitates the creation and management of database users and their permissions, enhancing security and access control.
- Database Optimization: Includes features for optimizing database performance, such as repairing and analyzing tables.
- Multilingual Support: Available in multiple languages, making it accessible to a global audience.
- 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
phpMyAdmin Alternatives
There are several alternatives to phpMyAdmin for managing MySQL and MariaDB databases. Some popular alternatives include:
- 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.
- 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.
- 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.
- 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.
- 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 – mariadb-01.centlinux.com
- IP Address – 192.168.116.128 /24
Update your Rocky Linux Server
By using a SSH client software, login to mariadb-01.centlinux.com 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. Complete!
Check the Linux Operating System and Kernel versions as follows.
# cat /etc/rocky-release && uname -r Rocky Linux release 8.5 (Green Obsidian) 4.18.0-348.20.1.el8_5.x86_64
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/multi-user.target.wants/httpd.service → /usr/lib/systemd/system/httpd.service. Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service → /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 success # firewall-cmd --reload success
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 https://files.phpmyadmin.net/phpMyAdmin/5.1.3/phpMyAdmin-5.1.3-english.tar.gz --2022-04-14 23:13:01-- https://files.phpmyadmin.net/phpMyAdmin/5.1.3/phpMyAdmin-5.1.3-english.tar.gz Resolving files.phpmyadmin.net (files.phpmyadmin.net)... 37.19.218.108, 2a02:6ea0:e100::7 Connecting to files.phpmyadmin.net (files.phpmyadmin.net)|37.19.218.108|: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/config.sample.inc.php /var/www/html/pma/config.inc.php
Open phpMyAdmin configuration file in vim text editor.
# vi /var/www/html/pma/config.inc.php
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; MariaDB [(none)]> FLUSH PRIVILEGES;
Open URL https://mariadb-01.centlinux.com/pma/ in a web browser.
Login as MySQL admin user.
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.