How To Configure And Install PhpMyAdmin With Apache

Database like MySQL and MariaDB perform significant roles of any websites.  All user are not comfortable to administering the database from command line.To make database administering easily phpMyAdmin was created. It is web-base management tool.I will explain in this guide how to install and configure phpMyAdmin.


Before going ahead we need some requirements.

  1. Make sure you have good build Linux system and OS installed properly.
  2. Before starting phpMyAdmin make sure LAMP ( Linux,Apache,MySQL and PHP ) stack is properly installed in your system

If everything is properly functioning than we can start installation. To install phpMyAdmin we need to install EPEL repo. It contain many packages including phpMyAdmin. There are no phpMyAdmin package available in Centos 6 default repository. That’s why we need to install  EPEL repository.

PhpMyAdmin Installation

EPEL repository installation:-

#yum install epel-release

After installing epel repo we will install phpMyAdmin package

#yum install phpmyadmin

phpMyAdmin.conf file automatically create in /etc/httpd/conf.d location after installation complete. We will need to modify a bit to get it work.

Open /etc/httpd/conf.d/phpMyAdmin.conf

# vim /etc/httpd/conf.d/phpMyAdmin.conf

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

Require ip

Require ip ::1



<IfModule !mod_authz_core.c>

Apache 2.2

Order Deny,Allow

Deny from All

Allow from All

Allow from ::1


<Files ~ "^\.ht">

Deny from all



AuthUserFile /etc/httpd/htpasswd

AuthName "Restricted"

AuthType Basic require valid-user


Save and exit.

There are two directives are define for Apache version >2.4 AND <2.2. In Apache 2.4 and its upper version Require ip work. In Apache 2.2 and its lower version Order Deny,Allow work.

Now you can edit it according to your Apache version. I am using Apache 2.2 that’s why I have allowed from all and secure it with user and password. You can configure it IP base restriction like ‘ Allow from your_ip ‘ .

Than restart Apache service.

#service httpd restart
Stopping httpd:                                            [  OK  ]
Starting httpd:                                            [  OK  ]

phpMyAdmin is ready to work. You can type http://server_ip_or_domain/phpMyAdmin/  in you browser to access it.

For example

It will prompt you to type user name and password if it is restricted. If it is configured with IP base restriction it will not prompt for any username and password.


To login use your valid database username/password .


You can see your all databases.


Create Password for Authentication

#htpasswd –c  /etc/httpd/htpasswd username

New password:                      #Type your password here
Re-type new password:              #Retype password
Adding password for user username
Password created succssfully .

Type it will prompt you for authentication.



Thank you! for visiting LookLinux.

If you find this tutorial helpful please share with your friends to keep it alive. For more helpful topic browse my website To become an author at LookLinux Submit Article. Stay connected to Facebook.

About the author


Santosh Prasad

Hi! I'm Santosh and I'm here to post some cool article for you. If you have any query and suggestion please comment in comment section.

Leave a Comment