Install phpMyAdmin 4.4.15 on CentOS 7 / RHEL 7

phpMyAdmin is the web-based administration tool for managing the MySQL, MariaDB and Drizzle servers. It helps in performing databases activities such as creating, deleting, querying, tables, columns, relations, indexes, users, permissions, etc. This guide will help you to install phpMyAdmin on CentOS 7 / RHEL 7.

Before installing phpMyAdmin, you must have LAMP installed on the server. Here is the tutorial on Installing LAMP on CentOS 7 / RHEL 7.

Install phpMyAdmin

phpMyAdmin is available in EPEL, so Install EPEL repository rpm.

rpm -Uvh https://dl.fedoraproject.org/pub/epel/epel-release-latest-7.noarch.rpm

Install phpMyAdmin using the following command.

yum -y install phpmyadmin

Install php

please make sure Install php package itself  using the following command.

yum -y install php

 

Configure phpMyAdmin

phpMyAdmin places the configuration files in /etc/httpd/conf.d directory. It has rules and permission for the access.

By default, phpMyAdmin can be accessed only from the localhost, to change that; we have to edit the phpMyAdmin.conf file.

In CentOS 7, web access is managed by the mod_authz_core.c module; so normal allow or deny rules won’t work even if you modify.

vi /etc/httpd/conf.d/phpMyAdmin.conf

Default config will look like below.

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
 # Apache 2.4
 <RequireAny>
 Require ip 127.0.0.1
 Require ip ::1
 </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2
 Order Deny,Allow
 Deny 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>
 Require ip 127.0.0.1
 Require ip ::1
 </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2
 Order Deny,Allow
 Deny from All
 Allow from 127.0.0.1
 Allow from ::1
 </IfModule>
</Directory>

Please comment out Require ip 127.0.0.1 and Require ip ::1 then add Require all granted just below to commented line, it will look like below.

Alias /phpMyAdmin /usr/share/phpMyAdmin
Alias /phpmyadmin /usr/share/phpMyAdmin

<Directory /usr/share/phpMyAdmin/>
 AddDefaultCharset UTF-8

<IfModule mod_authz_core.c>
 # Apache 2.4
 <RequireAny>
 # Require ip 127.0.0.1
 # Require ip ::1
 Require all granted
 </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2
 Order Deny,Allow
 Deny 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>
 # Require ip 127.0.0.1
 # Require ip ::1
 Require all granted
 </RequireAny>
 </IfModule>
 <IfModule !mod_authz_core.c>
 # Apache 2.2
 Order Deny,Allow
 Deny from All
 Allow from 127.0.0.1
 Allow from ::1
 </IfModule>
</Directory>

Restart the services.

systemctl restart httpd

Configure the firewall to allow HTTP request from the external network.

firewall-cmd --permanent --zone=public --add-service=http
firewall-cmd --reload

Access phpMyAdmin

Now access the phpMyAdmin from the browser, URL will be:

http://localhost/phpMyAdmin     (on the server)

OR

http://your-server-ip-address/phpMyAdmin   (on any part of the network

Login with the root (DB admin) or any database user.

Install phpMyAdmin on CentOS 7 - phpMyadmin Login Page
Install phpMyAdmin 4.x on CentOS 7 – phpMyadmin Login Page

You will get the database page.

Install phpMyAdmin on CentOS 7 - phpMyadmin Home Page
Install phpMyAdmin 4.x on CentOS 7

That’s All. Hope this helped you, we welcome your comments.

Leave a comment