PhpMyAdmin is a well most popular web-based client for managing MySQL server. PHPMyAdmin is written in PHP programming language. It provides a user-friendly web interface to access and manage your databases. To ease usage to a wide range of people, phpMyAdmin is being translated into 72 languages and supports both LTR and RTL languages. This article will help you to install phpMyAdmin on CentOS/RedHat System.
Prerequsities
In order to use PHPMyAdmin, you must have PHP, MySQL and Apache installed on your system. Also, you need PHP-MySQL or PHP-MySQLi module enabled in PHP configuration. For the current version of PHPMyAdmin 4.7.2, the requirements are as follows.
- Apache >= 2.2
- PHP >= 5.5
- MySQL/MariaDB >= 5.5
Use the tutorial: Installing Apache MySQL PHP on CentOS and RedHat
Enable Remi Repository
phpMyAdmin most updated package is available in Remi repository. Install it in your system using following commands.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 |
### CentOS/RHEL 7 ### rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm ### CentOS/RHEL 6 ### rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm ### Fedora 27 ### rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-27.rpm ### Fedora 26 ### rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-26.rpm ### Fedora 25 ### rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-25.rpm |
Install PhpMyAdmin
After enabling Remi repository on your system, let’s start the with the installation of phpMyAdmin using yum package manager. All the dependencies will automatically be installed.
1 |
yum --enablerepo=remi,remi-test install phpMyAdmin httpd php |
Configure PhpMyAdmin
phpMyAdmin by default allowed to access from localhost only. If you want to make it accessible from remote computers edit /etc/httpd/conf.d/phpMyAdmin.conf and update all 127.0.0.1 with your network like below or enable phpMyAdmin access for everyone.
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 |
cat << EOT > /etc/httpd/conf.d/phpMyAdmin.conf # phpMyAdmin - Web based MySQL browser written in php # # Allows only localhost by default # # But allowing phpMyAdmin to anyone other than localhost should be considered # dangerous unless properly secured by SSL Alias /phpMyAdmin /usr/share/phpMyAdmin Alias /phpmyadmin /usr/share/phpMyAdmin <Directory /usr/share/phpMyAdmin/> Options Indexes FollowSymLinks MultiViews AllowOverride all Require all granted AddDefaultCharset UTF-8 <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> #ADD following line: Require all granted Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 #CHANGE following 2 lines: Order Allow,Deny Allow from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> <Directory /usr/share/phpMyAdmin/setup/> <IfModule mod_authz_core.c> # Apache 2.4 <RequireAny> #ADD following line: Require all granted Require ip 127.0.0.1 Require ip ::1 </RequireAny> </IfModule> <IfModule !mod_authz_core.c> # Apache 2.2 #CHANGE following 2 lines: Order Allow,Deny Allow from All Allow from 127.0.0.1 Allow from ::1 </IfModule> </Directory> # These directories do not require access over HTTP - taken from the original # phpMyAdmin upstream tarball # <Directory /usr/share/phpMyAdmin/libraries/> Order Deny,Allow Deny from All Allow from None </Directory> <Directory /usr/share/phpMyAdmin/setup/lib/> Order Deny,Allow Deny from All Allow from None </Directory> <Directory /usr/share/phpMyAdmin/setup/frames/> Order Deny,Allow Deny from All Allow from None </Directory> # This configuration prevents mod_security at phpMyAdmin directories from # filtering SQL etc. This may break your mod_security implementation. # #<IfModule mod_security.c> # <Directory /usr/share/phpMyAdmin/> # SecRuleInheritance Off # </Directory> #</IfModule> EOT |
Add Rulse Firewall
1 2 3 4 |
firewall-cmd --permanent --zone=public --add-service=http firewall-cmd --permanent --zone=public --add-service=https firewall-cmd --zone=public --add-service=mysql --permanent firewall-cmd --reload |
After updating phpMyAdmin Apache configuration file, restart Apache service to reload new settings.
1 |
systemctl restart httpd |
Access phpMyAdmin in Browser
Now you can access phpMyAdmin in a browser using the following URL. Change svr1.tecadmin.net with your server IP/FQDN.
1 2 3 |
http://mysql.galaxydata.ru/phpMyAdmin/ Login Details: Use MySQL username and password. |
Congratulation’s You have successfully installed phpMyAdmin. Using single phpMyAdmin we can manage multiple MySQL servers by adding multiple remote MySQL server. Use this article to add multiple MySQL hosts in phpMyAdmin.