How do I install phpMyAdmin to handle the administration of MySQL database server over the World Wide Web under Fedora / Scientific / CentOS / RHEL / Red Hat Enterprise Linux 6.x server systems? How do I install and securely configure phpMyAdmin on a CentOS 6.x / RHEL 6.x server?

Tutorial details
Difficulty level Easy
Root privileges Yes
Requirements None
Est. reading time 10m
phpMyAdmin is a tool written in PHP intended to handle the administration of MySQL over the World Wide Web. Most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, while you still have the ability to directly execute any SQL statement. It comes with an intuitive web interface, support for most MySQL features. This faq explains how to install and configure phpMyAdmin on a CentOS or RHEL version 6.x.

Step #1: Turn on EPEL repo

phpMyAdmin is not included in default RHEL / CentOS repo. So turn on EPEL repo as described here:
$ cd /tmp
$ wget
# rpm -ivh epel-release-6-8.noarch.rpm

Step #2: Install phpMyAdmin on a CentOS / RHEL Linux

Type the following yum command to download and install phpMyAdmin:
# yum search phpmyadmin
# yum -y install phpmyadmin

Sample outputs:

Loaded plugins: rhnplugin
Setting up Install Process
Resolving Dependencies
There are unfinished transactions remaining. You might consider running yum-complete-transaction first to finish them.
--> Running transaction check
---> Package phpMyAdmin.noarch 0:3.5.1-1.el6 will be installed
--> Finished Dependency Resolution
Dependencies Resolved
 Package                  Arch                 Version                   Repository          Size
 phpMyAdmin               noarch               3.5.1-1.el6               epel               4.2 M
Transaction Summary
Install       1 Package(s)
Total download size: 4.2 M
Installed size: 17 M
Downloading Packages:
phpMyAdmin-3.5.1-1.el6.noarch.rpm                                          | 4.2 MB     00:00     
Running rpm_check_debug
Running Transaction Test
Transaction Test Succeeded
Running Transaction
  Installing : phpMyAdmin-3.5.1-1.el6.noarch                                                  1/1 
  Verifying  : phpMyAdmin-3.5.1-1.el6.noarch                                                  1/1 
  phpMyAdmin.noarch 0:3.5.1-1.el6

Install MySQL server on a CentOS/RHEL

You need download and install MySQL server on CentOS/RHEL using the following yum command:
# yum install mysql-server mysql
Turn on and start the mysql service, type:
# chkconfig mysqld on
# service mysqld start

Set root password and secure mysql installation by running the following command:
# mysql_secure_installation

Step #3: Configure phpMyAdmin

You need to edit /etc/httpd/conf.d/phpMyAdmin.conf file, enter:
# vi /etc/httpd/conf.d/phpMyAdmin.conf
It allows only localhost by default. You can setup HTTPD SSL as described here (mod_ssl) and allow LAN / WAN users or DBA user to manage the database over www. Find line that read follows

Require ip

Replace with your workstation IP address:

Require ip

Again find the following line:

Allow from

Replace as follows:

Allow from

Save and close the file. Restart Apache / httpd server:
# service httpd restart
Open a web browser and type the following url:
Sample outputs:

Fig.01: phpMyAdmin in Action

Please note that you will be prompted for a username and password. You need to provide your database username and password to login into the user interface. If you want to manage all database use mysql admin user account called root. phpMyAdmin configuration file is located at /etc/phpMyAdmin/ You can edit this file using a text editor:
# vi /etc/phpMyAdmin/
All directives are explained in Documentation.html and on phpMyAdmin wiki.

Check out related media

This tutorial is also available in video format:

(Video.01: Installing phpMyAdmin Demo)

And, there you have it, the phpMyAdmin installed and working correctly on the latest version of CentOS / Red Hat Enterprise Linux to manage your database software from the Internet.

🐧 Get the latest tutorials on Linux, Open Source & DevOps via RSS feed or Weekly email newsletter.

🐧 20 comments so far... add one

CategoryList of Unix and Linux commands
Disk space analyzersdf duf ncdu pydf
File Managementcat cp mkdir tree
FirewallAlpine Awall CentOS 8 OpenSUSE RHEL 8 Ubuntu 16.04 Ubuntu 18.04 Ubuntu 20.04
Modern utilitiesbat exa
Network UtilitiesNetHogs dig host ip nmap
OpenVPNCentOS 7 CentOS 8 Debian 10 Debian 8/9 Ubuntu 18.04 Ubuntu 20.04
Package Managerapk apt
Processes Managementbg chroot cron disown fg glances gtop jobs killall kill pidof pstree pwdx time vtop
Searchingag grep whereis which
User Informationgroups id lastcomm last lid/libuser-lid logname members users whoami who w
WireGuard VPNAlpine CentOS 8 Debian 10 Firewall Ubuntu 20.04
20 comments… add one
  • vonskippy Jul 26, 2012 @ 1:07

    MySQL Workbench, SQLyog, or HeidiSQL are all better tools and come without the bloat and security holes.

    Or you could spend a few minutes and learn to manage MySQL via CLI and not have the boatload of security risks that phpMyAdmin brings.

    I don’t get why everyone just “luvs” phpmyadmin, and yet still they wonder why/how their servers get compromised.

  • Mac Jul 26, 2012 @ 12:56

    If someone needs phpmyadmin add another alias interface (ip address) and put in a rule to only allow this through a gateway and/or ip-range.

    For some end users at an ISP they want this and using an ipchain you can lock it down, additional security.

  • munin Jul 27, 2012 @ 11:47

    rename phpmyadmin folder = mydbconf, dbmysite, xdbxconfx, etc
    move phpmyadmin to different subdomain =
    configure on different port =
    force SSL, no root, configure limit and burst on port :5169 in iptables.

  • gini Sep 10, 2012 @ 8:27

    Nice Article…
    thank you

  • Loring Safford Jan 22, 2013 @ 15:56

    I followed these instructions and had no problems – very good step by step description.

  • sajax Feb 4, 2013 @ 9:34

    Just a couple of thoughts:
    Re: instructions are fine except now version is epel-release-6-8 and should be used instead of the version numbers in the first part of the instructions…it is useful just to check this out before starting…i.e. what is the version number now?
    Re: vonskippy – If using a headless Linux based MySQL installation (as part of a LAMP stack) with either no or only limited direct connection to the server then myPHPAdmin still works well, (it doesn’t need any sort of GUI support at the server end).. although should be restricted/security hardened as mentioned in the other posts…HeidiSQL works but really is simplest to use on a MSWindows box, SQLyog is lovely but not free (good in serious production enviroments; but for development?) and the MySQLWorkbench depends on a GUI –

    However I also agree having some familiarity with the CLI is good idea….

  • Jake Mar 4, 2013 @ 15:44

    the 3rd step is not working on my end. Its not showing the ip adresses whenever im enterng these codes vi /etc/httpd/conf.d/phpMyAdmin.conf
    its showing BLANK. Please help me. Thanks!

  • mattia Apr 5, 2013 @ 9:28

    well done bro !
    hi from Venice

  • Raz Goren Nov 7, 2013 @ 14:07

    Now the link for epel rpm is :

    • 🐧 Nix Craft Jan 1, 2014 @ 11:01

      The tutorial has been updated. I appreciate your feedback.

  • cenots Mar 12, 2014 @ 2:53

    how to update myphpadmin to latest version 4.1.9

  • Marian May 12, 2014 @ 16:55

    You are missing the following:

    Order allow,deny
    Allow from all

  • Aamir Jul 16, 2014 @ 6:32

    can anyone help me to install phpmyadmin please reply me

  • 440Music Jul 28, 2014 @ 17:23

    Why didn’t I find this 3 months ago!!
    I can not beleive how easy this made installing phpMyAdmin

    Thank you,

  • JAY Sep 12, 2014 @ 13:50

    Very Nice

  • Ruth Nov 5, 2014 @ 18:13

    Thanks for the helpful article. I did have a problem accessing the url at the end and eventually discovered that I hadn’t got php installed. As you include the installation of mysql in your step by step guide, I was surprised that the step to install php wasn’t mentioned.

  • Gerrit on a Good Day Feb 1, 2015 @ 16:51

    What a nightmare of security gaps when this is hosted on a public server using default settings! The simple security stops you can apply in phpMyAdmin.conf are:
    1. Very specific IP address access restriction
    2. Replacing the phpmyadmin Alias with a password-strength, secret alias. This should stop adversaries from trying to enumerate the services on your server.
    Generate a nonce like this:
    openssl rand -base64 8 | tr -cd ‘[[:alnum:]]._-‘ | sed -e ‘s/\(.\{8\}\).*/\1\n/’

  • sawan Jul 30, 2015 @ 11:35

    i am not able to phpmyadmin accessss in my another computer
    my pc configuration
    OS Centos 7 also installed LAMP
    locally its working good but iin network i am not able to access phpmy admin page
    Error in network pc as below…
    You don’t have permission to access /phpmyadmin on this server.
    pls revert me asap.

  • Matt Aug 25, 2015 @ 22:18

    I’m running Oracle linux 6 which is taken from CentOS/RHEL.
    I also needed to install php (yum install php) and add “DirectoryIndex index.php” to /etc/httpd/conf.d/phpMyAdmin.conf

    Thank you for these instructions.

    Many of us use dhcp so it might be helpful to know how to open access up to an entire subnet (or just everything).


  • Sujay U N May 24, 2016 @ 12:48

    To Install httpd i followed below steps :
    sudo yum install -y httpd24 php56 mysql55-server php56-mysqlnd

    |::| Restart the apache service:
    sudo service httpd restart

    |::| To install phpmyadmin, i followed ur steps

    But it never asked me to set for Username and Pwd
    How to set the Username and pwd for mysql and phpmyadmin ?

Leave a Reply

Your email address will not be published.

Use HTML <pre>...</pre> for code samples. Still have questions? Post it on our forum