Installing phpMyAdmin in CentOS 10 allows you to manage MySQL and MariaDB databases through a web-based interface. This guide is for system administrators and developers who are looking for a step-by-step method to install phpMyAdmin in CentOS 10. It uses best practices that ensure performance and security. You can set up phpMyAdmin quickly for CentOS 10 database administration by configuring Apache and handling SELinux correctly.
This guide explains the steps to install phpMyAdmin on CentOS 10, configure Apache, fix SELinux problems, and secure your setup.
Table of Content
- How to Install phpMyAdmin on CentOS 10
- Optional Security Hardening (Recommended)
- How to Uninstall phpMyAdmin on CentOS 10
- Common Errors and Fixes
- Conclusion
How to Install phpMyAdmin on CentOS 10
phpMyAdmin, a web-based MySQL/MariaDB management tool, is widely used to administer databases on Linux servers. Installing phpMyAdmin on a CentOS server is the best way to manage databases and users through a web browser.
Step 1: Update the CentOS 10 System
Installing phpMyAdmin, and all its dependencies, is safer and more compatible if you keep your system up-to-date.
|
sudo dnf update |
|---|

Step 2: Enable EPEL Repository on CentOS 10
phpMyAdmin does not appear in the CentOS default repositories. Therefore, EPEL must be enabled to gain access to additional packages.
|
sudo dnf install epel-release -y |
|---|

Step 3: Install phpMyAdmin on CentOS 10
Install phpMyAdmin with the DNF Package Manager once EPEL has been enabled.
|
sudo dnf install phpmyadmin -y |
|---|

Step 4: Install Required PHP Extensions
phpMyAdmin needs specific PHP modules in order to connect with MySQL and MariaDB, and manage sessions correctly.
|
sudo dnf install php php-mysqlnd php-json php-mbstring php-zip php-gd -y |
|---|

Step 5: Start and Enable Apache Web Server
Apache must be running in order to serve phpMyAdmin through the browser.
|
sudo systemctl start httpd sudo systemctl enable httpd |
|---|

Step 6: Configure Apache Access for phpMyAdmin
phpMyAdmin by default is limited to localhost. By editing the Apache configuration, external access is possible. Open the configuration file:
|
sudo nano /etc/httpd/conf.d/phpMyAdmin.conf |
|---|
Replace:
|
Require ip 127.0.0.1 |
|---|
Step 7: Restart Apache to Apply Changes
Restarting Apache will apply the updated configuration to your browser and enable it.
|
sudo systemctl restart httpd |
|---|

Step 8: Configure SELinux for Database Connectivity
SELinux can block Apache from connecting to the database. This command allows secure communications.
|
sudo setsebool -P httpd_can_network_connect_db 1 |
|---|

Step 9: Access phpMyAdmin via Web Browser
Now you can access phpMyAdmin by using the IP address of your server.
|
http://your-server-ip/phpmyadmin |
|---|

Use your MySQL or MariaDB Root credentials to log in.
Optional Security Hardening (Recommended)
Installing phpMyAdmin in CentOS 10 allows you to manage MySQL databases and MariaDB databases with ease and without relying on the command line. phpMyAdmin can be used by both novices and system administrators. By following the correct configuration steps and implementing basic security measures, phpMyAdmin will become a reliable tool for database administration. Keep phpMyAdmin up-to-date and limit access to ensure server security.
Change the phpMyAdmin URL
By changing the URL, you can protect yourself from brute-force attacks.
|
sudo mv /usr/share/phpMyAdmin /usr/share/db-admin-secure |
|---|

Update Apache configuration as necessary.
Restrict Access by IP
phpMyAdmin is more secure when only trusted IPs are allowed to access the server.
How to Uninstall phpMyAdmin on CentOS 10
You can uninstall phpMyAdmin using the DNF Package Manager if you no longer require it or wish to remove it due to security concerns. This will remove the phpMyAdmin package, while leaving your MySQL or MariaDB databases intact.
Let’s remove phpMyAdmin and its related configuration files from CentOS 10:
|
sudo dnf remove phpmyadmin -y |
|---|

Common Errors and Fixes
- 403 Forbidden: Check Apache permissions and phpMyAdmin.conf
- Blank Page: Missing PHP extensions
- Cannot Login: Verify MySQL/MariaDB service status
Conclusion
To install phpMyAdmin on CentOS 10, first enable the EPEL repository, then install phpMyAdmin and require PHP extensions using DNF. Configure Apache to allow external access, adjust SELinux permissions to enable database connectivity, and restart the web server. Once installed, phpMyAdmin can be accessed via a browser at /phpmyadmin, providing a secure and user-friendly interface for managing MySQL and MariaDB databases on CentOS 10.








Leave feedback about this