phpMyAdmin is an open-source, web-based administration tool for managing the MySQL and MariaDB servers. It is one of the most popular database administration tools used by hosting companies and system administrators for performing database activities such as creating, deleting, querying, tables, columns, relations, indexes, users, permissions, etc.
phpMyAdmin is a portable web application written in PHP. It is released under GNU GPL v2.
In this post, we will see how to install phpMyAdmin with Apache on CentOS 8 / RHEL 8.
Prerequisites
Install MySQL / MariaDB Server
Before installing phpMyAdmin, you must have one database instance (MySQL or MariaDB) running on your system to connect. It could be a standalone database instance or installed as part of the LAMP stack.
Standalone Database
READ: How To Install MariaDB on CentOS 8 / RHEL 8
READ: How To Install MySQL 8.0 on CentOS 8 / RHEL 8
Install PHP, MySQL support package for PHP, and other PHP packages on your system for phpMyAdmin to connect with the database.
$cfg['blowfish_secret'] = 'bo95yavJ;V,1PzSlxyFwtyMJ}WmG98-6'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
Import the create_tables.sql to create new tables for phpMyAdmin.
mysql
Create an alias in the Apache web server so that phpMyAdmin can be accessed with http://your-ip-add-dress/phpmyadmin.
vi /etc/httpd/conf.d/phpMyAdmin.conf
Copy and paste the below content to the above file.
Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin
AddDefaultCharset UTF-8
# Apache 2.4
Require all granted
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
# Apache 2.4
Require all granted
# Apache 2.2
Order Deny,Allow
Deny from All
Allow from 127.0.0.1
Allow from ::1
Create a tmp directory for phpMyAdmin and change the permission.
Read the important notes before accessing phpMyAdmin with root or regular database users.
MySQL 8.x
MySQL 8.0 installed from MySQL Dev Community repository uses a caching_sha2_password mechanism for authentication which prevents legacy application to access databases including phpMyAdmin at this moment. In simple terms, you won’t be login to phpMyAdmin unless we disable this new password mechanism.
You can globally disable the new password mechanism by placing default-authentication-plugin=mysql_native_password in /etc/my.cnf (Users created after this change will have mysql_native_password authentication mechanism) or you can revert to the old native authentication (mysql_native_password) for individual users (Ex: root) by running ALTER USER ‘root’@’localhost’ IDENTIFIED WITH mysql_native_password BY ‘’; command in MySQL terminal.
Access phpMyAdmin
Now access the phpMyAdmin from the browser, URL will be:
http://localhost/phpMyAdmin
OR
http://your-ip-addr-ess/phpMyAdmin
Login with the root (DB admin) or any database user.
Install phpMyAdmin with Apache on CentOS 8 – phpMyAdmin Login Page
You will get the database page where you can perform all database activities.
Install phpMyAdmin with Apache on CentOS 8 – phpMyAdmin Home
Conclusion
I hope you have learned how to install phpMyAdmin on with Apache CentOS 8 / RHEL 8 to manage MariaDB and MySQL database. In addition to this, you can take a look at how to secure your phpMyAdmin installation.