Follow our comprehensive guide to install phpMyAdmin on CentOS 8. Get clear, step-by-step instructions to configure phpMyAdmin and manage your MySQL databases with ease. #centlinux #linux #mysql
phpMyAdmin is the most widely used software for database administration of MariaDB/MySQL databases. phpMyAdmin is written in PHP and JavaScript and distributed under GNU GPL 2 license.
MariaDB/MySQL does not include a native GUI interface for database administration. Therefore, we install phpMyAdmin side by side on the MariaDB/MySQL server to provide a web user interface to sysadmins and developers.
In this lab, you will learn how to install phpMyAdmin on CentOS 8 server.
Recommended Training for You: SQL: Master SQL With PhpMyAdmin and MYSQL Engine
Some of the features of phpMyAdmin are:
For complete list of features, please refer to phpMyAdmin documentation.
phpMyAdmin 5.0.1 needs following software prerequisites.
If you’re looking for alternatives to phpMyAdmin for managing MySQL or MariaDB databases, there are several other tools and platforms available. Here are some of the best phpMyAdmin alternatives, each with its own set of features and benefits:
Tool | Platform | Key Features | Price |
---|---|---|---|
Adminer | Web-based | Lightweight, multiple DB support | Free |
MySQL Workbench | Windows/macOS/Linux | Visual design, SQL editor, performance tools | Free |
DBeaver | Windows/macOS/Linux | Multi-DB support, ER diagrams | Free |
HeidiSQL | Windows | Lightweight, SSH support | Free |
Sequel Pro | macOS | Native macOS app, query editor | Free |
SQuirreL SQL | Java-based | Multi-DB support, plugin-based | Free |
TablePlus | Windows/macOS/Linux | Modern UI, multi-tab support | Paid |
Valentina Studio | Windows/macOS/Linux | Visual design, comparison tools | Free/Paid |
Beekeeper Studio | Windows/macOS/Linux | Modern UI, cross-platform | Free |
MySQL Shell | Windows/macOS/Linux | Advanced scripting, InnoDB Cluster | Free |
These alternatives offer various features that may better suit your specific needs or preferences compared to phpMyAdmin.
Feel free to explore these options to find the best tool for your database management needs!
We are using a minimal CentOS 8 virtual machine with following specification.
phpMyAdmin is a PHP based web application that requires PHP hypertext preprocessor and a supported web server for deployment. Therefore, we are installing LAMP Stack on CentOS 8.
Apache, MariaDB (a MySQL variant) and PHP are available in standard yum repositories, thus we can install them using a dnf command.
# dnf install -y @mariadb @httpd @php
Install php-mysqlnd package for PHP to MariaDB connectivity.
# dnf install -y php-mysqlnd
Enable and start MariaDB service.
# systemctl enable --now mariadb.service Created symlink /etc/systemd/system/mysql.service â /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/mysqld.service â /usr/lib/systemd/system/mariadb.service. Created symlink /etc/systemd/system/multi-user.target.wants/mariadb.service â /usr/lib/systemd/system/mariadb.service.
Configure MariaDB instance and set root user password.
# mysql_secure_installation
NOTE: RUNNING ALL PARTS OF THIS SCRIPT IS RECOMMENDED FOR ALL MariaDB
SERVERS IN PRODUCTION USE! PLEASE READ EACH STEP CAREFULLY!
In order to log into MariaDB to secure it, we'll need the current
password for the root user. If you've just installed MariaDB, and
you haven't set the root password yet, the password will be blank,
so you should just press enter here.
Enter current password for root (enter for none):
OK, successfully used password, moving on...
Setting the root password ensures that nobody can log into the MariaDB
root user without the proper authorization.
Set root password? [Y/n] Y
New password:
Re-enter new password:
Password updated successfully!
Reloading privilege tables..
... Success!
By default, a MariaDB installation has an anonymous user, allowing anyone
to log into MariaDB without having to have a user account created for
them. This is intended only for testing, and to make the installation
go a bit smoother. You should remove them before moving into a
production environment.
Remove anonymous users? [Y/n] Y
... Success!
Normally, root should only be allowed to connect from 'localhost'. This
ensures that someone cannot guess at the root password from the network.
Disallow root login remotely? [Y/n] Y
... Success!
By default, MariaDB comes with a database named 'test' that anyone can
access. This is also intended only for testing, and should be removed
before moving into a production environment.
Remove test database and access to it? [Y/n] Y
- Dropping test database...
... Success!
- Removing privileges on test database...
... Success!
Reloading the privilege tables will ensure that all changes made so far
will take effect immediately.
Reload privilege tables now? [Y/n] Y
... Success!
Cleaning up...
All done! If you've completed all of the above steps, your MariaDB
installation should now be secure.
Thanks for using MariaDB!
Test MariaDB database connectivity.
# mysql -u root -p123 Welcome to the MariaDB monitor. Commands end with ; or g. Your MariaDB connection id is 16 Server version: 10.3.17-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 a directory to store SSL certificate and private key.
# mkdir /etc/httpd/ssl
Generate a self signed SSL certificate using openssl command. You can also generate a CSR (Certificate Signing Request) and get it signed by a Certificate Authority Server in your network.
# openssl req -x509 -nodes -days 1095 -newkey rsa:2048 -out /etc/httpd/ssl/lamp.crt -keyout /etc/httpd/ssl/lamp.key Generating a RSA private key ...........................+++++ .............................................................+++++ writing new private key to '/etc/httpd/ssl/lamp.key' ----- You are about to be asked to enter information that will be incorporated into your certificate request. What you are about to enter is what is called a Distinguished Name or a DN. There are quite a few fields but you can leave some blank For some fields there will be a default value, If you enter '.', the field will be left blank. ----- Country Name (2 letter code) [XX]:PK State or Province Name (full name) []:Sindh Locality Name (eg, city) [Default City]:Karachi Organization Name (eg, company) [Default Company Ltd]:Ahmer's SysAdmin Recipes Organizational Unit Name (eg, section) []:IT Lab Common Name (eg, your name or your server's hostname) []:phpmyadmin-01.sysadminlabs.com Email Address []:root@phpmyadmin-01.sysadminlabs.com
Edit Apache configuration files to add SSL certificate and private key.
# vi /etc/httpd/conf.d/ssl.conf
Find and update following directives in this file.
SSLCertificateFile /etc/httpd/ssl/lamp.crt SSLCertificateKeyFile /etc/httpd/ssl/lamp.key
Enable and start Apache service.
# systemctl enable --now httpd.service Created symlink /etc/systemd/system/multi-user.target.wants/httpd.service â /usr/lib/systemd/system/httpd.service.
Enable and start php-fpm service.
# systemctl enable --now php-fpm.service Created symlink /etc/systemd/system/multi-user.target.wants/php-fpm.service â /usr/lib/systemd/system/php-fpm.service.
Allow Apache default service port in CentOS 8 firewall.
# firewall-cmd --permanent --add-service=https success # firewall-cmd --reload success
Open URL https://phpmyadmin-01.sysadminlabs.com in a web browser.
If you are using a self signed SSL certificate, then browser will display a security warning. Ignore it and continue.
Our LAMP Server has been configured successfully.
Download latest version of phpMyAdmin from phpMyAdmin official website.
Currently, the phpMyAdmin 5.0.1 is the latest stable release. Therefore, we are downloading it from phpMyAdmin official download page.
# cd /tmp # wget https://files.phpmyadmin.net/phpMyAdmin/5.0.1/phpMyAdmin-5.0.1-english.tar.gz --2020-02-05 17:09:13-- https://files.phpmyadmin.net/phpMyAdmin/5.0.1/phpMyAdmin-5.0.1-english.tar.gz Resolving files.phpmyadmin.net (files.phpmyadmin.net)... 84.17.57.12 Connecting to files.phpmyadmin.net (files.phpmyadmin.net)|84.17.57.12|:443... connected. HTTP request sent, awaiting response... 200 OK Length: 8158876 (7.8M) [application/octet-stream] Saving to: âphpMyAdmin-5.0.1-english.tar.gzâ phpMyAdmin-5.0.1-en 100%[===================>] 7.78M 1.09MB/s in 8.0s 2020-02-05 17:09:22 (996 KB/s) - âphpMyAdmin-5.0.1-english.tar.gzâ saved [8158876/8158876]
You can install phpMyAdmin by extracting the downloaded TARBall in Apache default document root.
# tar xf phpMyAdmin-5.0.1-english.tar.gz --directory /var/www/html
Rename extracted directory for better accessibility.
# cd # mv /var/www/html/phpMyAdmin-5.0.1-english/ /var/www/html/pma
Create phpMyAdmin database and related objects in MariaDB server using a script that was provided by the vendor in phpMyAdmin directory.
# mysql -u root -p123 < /var/www/html/pma/sql/create_tables.sql
Make a copy of sample configuration file.
# cp /var/www/html/pma/config.sample.inc.php /var/www/html/pma/config.inc.php
Edit config.inc.php file in a text editor.
# vi /var/www/html/pma/config.inc.php
Set a 32 character Blowfish secret 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 the owner of pma 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
Open URL https://phpmyadmin-01.sysadminlabs.com/pma/ in a web browser.
Login as root user.
After successful login, you are reached at the Dashboard of phpMyAdmin application.
To start using phpMyAdmin, you should read Mastering phpMyAdmin 3.4 for Effective MySQL Management (PAID LINK) by Packt Publishing.
Install phpMyAdmin on CentOS 8 is a great way to streamline the management of your MySQL databases with a user-friendly web interface. With the right steps, you can get phpMyAdmin up and running quickly to make database administration more efficient.
For a detailed, step-by-step guide on how to install phpMyAdmin on CentOS 8, check out my Fiverr gig: How to Install phpMyAdmin on CentOS 8. I offer expert support to ensure your phpMyAdmin setup is smooth and successful.
If you have any questions or need further assistance, feel free to reach out!
Puppy Linux is a fast, lightweight OS designed for speed and simplicity, perfect for old…
Learn how to change Apache document root in Linux by following this step-by-step guide. Adjust…
Discover how to change Apache port in Linux easily. Follow our simple guide to modify…
Learn how to create a virtual host in Apache Server with this comprehensive guide. Set…
Discover 10 practical tasks for the RHCSA exam with step-by-step solutions. Boost your Linux skills…
Discover the ultimate Fail2ban configuration guide. Learn how to set up, customize, and optimize Fail2ban…
This website uses cookies.
View Comments
Thank you for this beautiful tutorial, but I had a problem. I have not followed the example from the beginning, because I already had lamp installed. the problem was with SSL. I had to do a "dnf install mod_ssl" to be able to modify the /etc/httpd/conf.d/ssl.conf. There was none before that. I had tried to create it myself, but it didn't work. after installing mod_ssl, the file was there, I was able to modify the 2 lines for the crt and the key. Now it works great! Thank you for your work !
Thanks for your kind feedback.
We intentionally did not included the SSL configuration in this article, because we have already wrote an article on SSL Certificates in detail.