How to Install Latest PhpMyAdmin in RHEL, CentOS & Fedora

MySQL administration via command-line in Linux is very difficult job for any newbie system administrator or database administrator, because it contains numerous commands which we cannot remember in our daily life.

Suggested Read: MySQL Basic Database Administration Commands

To make MySQL administration much easier we’re introducing a web based MySQL administration tool called PhpMyAdmin, with the help of this tool you can control and manage your database administration via a web browser easily.

PhpMyAdmin is a web-based interface for managing MySQL / MariaDB databases that is used as a replacement for command-line utilities.

Suggested Read: 20 MySQL (Mysqladmin) Commands for Database Administration in Linux

It was written in PHP language, through this application you can do various MySQL administration tasks such as create, drop, alter, delete, import, export, search, query, repair, optimize and run other database management command via browser.

As other well-known web-based interfaces for managing system services, blog creation tools, or content management systems (CMSs), it is often targeted by malicious attackers who seek to exploit the usual lack of security measures.

In this article we’re going to show you how to install latest stable version of PhpMyAdmin for Apache or Nginx on RHEL, CentOS and Fedora distributions.

Here we’ve provided installation of PhpMyAdmin for both the web server’s Apache or Nginx. So, its up-to you which web server to choose for installation.

But do remember that, you must have working LAMP (Linux, Apache, PHP and MySQL/MariaDB) or LEMP (Linux, Nginx, PHP and MySQL/MariaDB) setup installed on your working system.

If you don’t have working LAMP or LEMP, you can follow our below articles to setup.

Install LAMP Stack

  1. Install LAMP Stack on RHEL/CentOS 7/6 & Fedora 28-24

Install LEMP Stack

  1. Install LEMP Stack on RHEL/CentOS 7/6 & Fedora 28-24

Step 1: Install EPEL and Remi Repositories

1. To install most recent version of PhpMyAdmin (i.e. 4.8), you need to install and enable EPEL and Remi repositories on your respective Linux distributions as shown:

On RHEL/CentOS 7

# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-7.rpm 

On RHEL/CentOS 6

-------------- On RHEL/CentOS 6 - 32-bit --------------
# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

-------------- On RHEL/CentOS 6 - 64-bit --------------
# yum install epel-release
# rpm -Uvh http://rpms.famillecollet.com/enterprise/remi-release-6.rpm

On Fedora 28-24

# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-28.rpm   [On Fedora 28]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-27.rpm   [On Fedora 27]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-26.rpm   [On Fedora 26]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-25.rpm   [On Fedora 25]
# rpm -Uvh http://rpms.famillecollet.com/fedora/remi-release-24.rpm   [On Fedora 24]

Step 2: Installing PhpMyAdmin Web Interface

2. Once you’ve installed above repositories, now its’ time to install PhpMyAdmin with the help of following command as shown.

# yum --enablerepo=remi install phpmyadmin

Note : If your are using PHP 5.4 on RHEL/CentOS/Fedora systems, then you need to run the below command to install it.

# yum --enablerepo=remi,remi-test install phpmyadmin

Step 3: Configuring PhpMyAdmin for Apache or Nginx

In Apache you don’t need to configure anything for phpMyAdmin, because you will get working phpMyAdmin automatically at the address http://<ip address>/phpmyadmin.

Suggested Read: MySQL Backup and Restore Commands for Database Administration

The main configuration file is located under /etc/httpd/conf.d/phpMyAdmin.conf, make sure the Require all granted directive (For Apache 2.4) and Allow from ip address is added inside the Directory /usr/share/phpmyadmin block.

PhpMyAdmin Allow Access
PhpMyAdmin Allow Access

Finally, restart Apache to apply changes.

-------------- On RHEL/CentOS 7 and Fedora 28-24 --------------
# systemctl restart httpd

-------------- On RHEL/CentOS 6 --------------
# service httpd restart

On the Nginx web server, we will create a symbolic link to PhpMyAdmin installation files to our Nginx web document root directory (i.e. /usr/share/nginx/html) by running the following command:

# ln -s /usr/share/phpMyAdmin /usr/share/nginx/html

Finally, restart Nginx and PHP-FPM to apply changes.

-------------- On RHEL/CentOS 7 and Fedora 28-24 --------------
# systemctl restart nginx
# systemctl restart php-fpm

-------------- On RHEL/CentOS 6 --------------
# service nginx restart
# service php-fpm restart

Step 4: Accessing PhpMyAdmin Web Interface

Open your browser and point your browser to http://<ip address>/phpmyadmin. It should open the phpmyadmin interface (as shown in the image below).

PhpMyAdmin Running on Fedora 24
PhpMyAdmin Running on Fedora 24

In the next articles, we will share some tips to secure your phpmyadmin installation on a LAMP or LEMP stack against the most common attacks carried out by malicious individuals.

Read Also: How to Secure Default PhpMyAdmin Login URL

If you read this far, tweet to the author to show them you care. Tweet a thanks
Ravi Saive
I am an experienced GNU/Linux expert and a full-stack software developer with over a decade in the field of Linux and Open Source technologies

Each tutorial at TecMint is created by a team of experienced Linux system administrators so that it meets our high-quality standards.

Join the TecMint Weekly Newsletter (More Than 156,129 Linux Enthusiasts Have Subscribed)
Was this article helpful? Please add a comment or buy me a coffee to show your appreciation.

55 thoughts on “How to Install Latest PhpMyAdmin in RHEL, CentOS & Fedora”

  1. Hello

    I followed the installation was great, but when i try to log to PHP i will get this error:

    mysqli_real_connect(): The server requested authentication method unknown to the client [caching_sha2_password]
    mysqli_real_connect(): (HY000/2054): The server requested authentication method unknown to the client
    

    I’m new in Linux world, please can you help?

    thanks

    Reply
    • @Joe,

      Log in to MySQL shell with root user:

      # mysql -u root -pPASSWORD
      

      and change the Authentication Plugin with the password there:

      mysql> ALTER USER root IDENTIFIED WITH mysql_native_password BY 'PASSWORD';
      Query OK, 0 rows affected (0.08 sec)
      
      Reply
  2. Hi, I can not run phpmyadmin I get error 403 Forbidden when I installed nginx as per your tutorial says and I followed the previous tutorial to install nginx the same works well.

    Reply
  3. Hello, Please update the EPEL repository version to latest as shown.

    rpm -Uvh http://dl.fedoraproject.org/pub/epel/7/x86_64/e/epel-release-7-8.noarch.rpm
    

    to

    https://dl.fedoraproject.org/pub/epel/7/x86_64/Packages/e/epel-release-7-11.noarch.rpm
    

    Thanks

    Reply
  4. i dont see any file or folder in /usr/share/nginx/html named as phpmyadmin which i can create symbolic link am using nginx

    any work around

    Reply
  5. I followed this tutorial and installed phpMyAdmin on my RHEL7 which is running on Amazon Web Services. But, I’m unable to use it. I am getting Forbidden Error when accessing. I also changed /etc/httpd/conf.d/phpMyAdmin.conf “Allow from 192.168.0.111″‘. Still getting Forbidden Error.

    Reply
    • @Premchand,

      Have you restarted Apache web server after making changes to phpMyAdmin.conf file? Try to make it Allow from all and see. if it works..

      Reply
  6. yum –enablerepo=remi,remi-php56 install phpmyadmin
    Loaded plugins: product-id, rhnplugin, search-disabled-repos, security,
    : subscription-manager
    This system is not registered with RHN Classic or RHN Satellite.
    You can use rhn_register to register.
    RHN Satellite or RHN Classic support will be disabled.
    Setting up Install Process
    epel/metalink | 5.5 kB 00:00
    epel | 4.3 kB 00:00
    remi-safe | 2.9 kB 00:00
    remi-safe/primary_db | 714 kB 00:01
    rhel-6-server-optional-rpms | 3.5 kB 00:00
    rhel-6-server-rpms | 3.5 kB 00:00
    webtatic | 3.6 kB 00:00
    Resolving Dependencies
    –> Running transaction check
    —> Package phpMyAdmin.noarch 0:4.0.10.18-1.el6 will be installed
    –> Processing Dependency: php-mcrypt >= 5.2.0 for package: phpMyAdmin-4.0.10.18-1.el6.noarch
    –> Processing Dependency: php-mbstring >= 5.2.0 for package: phpMyAdmin-4.0.10.18-1.el6.noarch
    –> Processing Dependency: php-gd >= 5.2.0 for package: phpMyAdmin-4.0.10.18-1.el6.noarch
    –> Processing Dependency: php-xmlwriter for package: phpMyAdmin-4.0.10.18-1.el6.noarch
    –> Processing Dependency: php-tcpdf-dejavu-sans-fonts for package: phpMyAdmin-4.0.10.18-1.el6.noarch
    –> Processing Dependency: php-tcpdf for package: phpMyAdmin-4.0.10.18-1.el6.noarch
    –> Processing Dependency: php-php-gettext for package: phpMyAdmin-4.0.10.18-1.el6.noarch
    –> Running transaction check
    —> Package php-gd.x86_64 0:5.3.3-48.el6_8 will be installed
    —> Package php-mbstring.x86_64 0:5.3.3-48.el6_8 will be installed
    —> Package php-php-gettext.noarch 0:1.0.12-1.el6 will be installed
    —> Package php-tcpdf.noarch 0:6.2.13-1.el6 will be installed
    –> Processing Dependency: php-tidy for package: php-tcpdf-6.2.13-1.el6.noarch
    –> Processing Dependency: php-posix for package: php-tcpdf-6.2.13-1.el6.noarch
    –> Processing Dependency: php-composer(fedora/autoloader) for package: php-tcpdf-6.2.13-1.el6.noarch
    –> Processing Dependency: php-bcmath for package: php-tcpdf-6.2.13-1.el6.noarch
    —> Package php-tcpdf-dejavu-sans-fonts.noarch 0:6.2.13-1.el6 will be installed
    —> Package php-xml.x86_64 0:5.3.3-48.el6_8 will be installed
    —> Package php71w-mcrypt.x86_64 0:7.1.1-1.w6 will be installed
    –> Processing Dependency: php71w-common(x86-64) = 7.1.1-1.w6 for package: php71w-mcrypt-7.1.1-1.w6.x86_64
    –> Processing Dependency: libmcrypt.so.4()(64bit) for package: php71w-mcrypt-7.1.1-1.w6.x86_64
    –> Running transaction check
    —> Package libmcrypt.x86_64 0:2.5.8-9.el6 will be installed
    —> Package php-bcmath.x86_64 0:5.3.3-48.el6_8 will be installed
    —> Package php-fedora-autoloader.noarch 0:0.2.1-2.el6 will be installed
    —> Package php-process.x86_64 0:5.3.3-48.el6_8 will be installed
    —> Package php-tidy.x86_64 0:5.3.3-48.el6_8 will be installed
    –> Processing Dependency: libtidy-0.99.so.0()(64bit) for package: php-tidy-5.3.3-48.el6_8.x86_64
    —> Package php71w-common.x86_64 0:7.1.1-1.w6 will be installed
    –> Running transaction check
    —> Package libtidy.x86_64 0:0.99.0-19.20070615.1.el6 will be installed
    –> Processing Conflict: php71w-common-7.1.1-1.w6.x86_64 conflicts php-common Finished Dependency Resolution
    Error: php71w-common conflicts with php-common-5.3.3-48.el6_8.x86_64
    You could try using –skip-broken to work around the problem
    You could try running: rpm -Va –nofiles –nodigest

    Not able to install the phpmyadmin.

    Reply
    • @Ajit,

      Its due to because, you’ve multiple third-party repositories enabled your system, try to disable them and install with remi repository..

      Reply
      • @Ravi – I also have the same issue. I have tried to remove the repos but I still have the same issue. Here is my repo list

        yum -v repolist
        Loading “rhnplugin” plugin
        Loading “product-id” plugin
        Loading “search-disabled-repos” plugin
        Loading “security” plugin
        Loading “subscription-manager” plugin
        Updating Subscription Management repositories.
        Unable to read consumer identity
        Config time: 0.080
        This system is receiving updates from RHN Classic or RHN Satellite.
        Looking for repo options for [main]
        Looking for repo options for [rhel-x86_64-server-6]
        Repo ‘rhel-x86_64-server-6’ setting option ‘enabled’ = ‘1’
        Repo ‘rhel-x86_64-server-6’ setting option ‘gpgcheck’ = ‘1’
        Yum Version: 3.2.29
        Setting up Package Sacks
        pkgsack time: 0.037
        Repo-id : epel
        Repo-name : Extra Packages for Enterprise Linux 6 – x86_64
        Repo-revision: 1491688862
        Repo-tags : binary-x86_64
        Repo-updated : Sat Apr 8 18:36:56 2017
        Repo-pkgs : 12,293
        Repo-size : 11 G
        Repo-metalink: https://mirrors.fedoraproject.org/metalink?repo=epel-6&arch=x86_64
        Updated : Sat Apr 8 18:36:56 2017
        Repo-baseurl : http://mirror.math.princeton.edu/pub/epel/6/x86_64/ (35 more)
        Repo-expire : 21,600 second(s) (last: Mon Apr 10 10:28:04 2017)

        Repo-id : remi-safe
        Repo-name : Safe Remi’s RPM repository for Enterprise Linux 6 – x86_64
        Repo-revision: 1491761087
        Repo-updated : Sun Apr 9 14:04:52 2017
        Repo-pkgs : 1,770
        Repo-size : 333 M
        Repo-mirrors : http://rpms.remirepo.net/enterprise/6/safe/mirror
        Repo-baseurl : http://rpms.remirepo.net/enterprise/6/safe/x86_64/ (32 more)
        Repo-expire : 21,600 second(s) (last: Mon Apr 10 10:28:11 2017)

        Repo-id : rhel-x86_64-server-6
        Repo-name : Red Hat Enterprise Linux Server (v. 6 for 64-bit x86_64)
        Repo-updated : Thu Apr 6 09:07:55 2017
        Repo-pkgs : 19,422
        Repo-size : 35 G
        Repo-baseurl : https://xmlrpc.rhn.redhat.com/XMLRPC/GET-REQ/rhel-x86_64-server-6
        Repo-expire : 21,600 second(s) (last: Mon Apr 10 10:28:14 2017)

        repolist: 33,485

        This is the error that I got:

        Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
        Requires: php-posix
        Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
        Requires: php-bcmath
        Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
        Requires: php-tidy
        Error: Package: phpMyAdmin-4.0.10.19-1.el6.noarch (epel)
        Requires: php-mbstring
        Error: Package: php-php-gettext-1.0.12-1.el6.noarch (epel)
        Requires: php-mbstring
        Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
        Requires: php-mbstring
        You could try using –skip-broken to work around the problem
        You could try running: rpm -Va –nofiles –nodigest

        Any suggestions? Thanks

        Reply
        • @Mallory,

          Remove or Disable all Repos except Default Repo and EPEL repo and try to install PhpMyAdmin using Epel repository.

          Reply
          • @ravi I get the same results even with disabling the other repos.

            yum –disablerepo=”*” –enablerepo=”epel” install phpmyadmin
            Loaded plugins: product-id, rhnplugin, search-disabled-repos, security, subscription-
            : manager
            This system is receiving updates from RHN Classic or RHN Satellite.
            Setting up Install Process
            Resolving Dependencies
            –> Running transaction check
            —> Package phpMyAdmin.noarch 0:4.0.10.19-1.el6 will be installed
            –> Processing Dependency: php-xmlwriter for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-tcpdf-dejavu-sans-fonts for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-tcpdf for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-php-gettext for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-mcrypt for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-mbstring for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-gd for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Running transaction check
            —> Package php-mcrypt.x86_64 0:5.3.3-5.el6 will be installed
            –> Processing Dependency: libmcrypt.so.4()(64bit) for package: php-mcrypt-5.3.3-5.el6.x86_64
            —> Package php-php-gettext.noarch 0:1.0.12-1.el6 will be installed
            –> Processing Dependency: php-mbstring for package: php-php-gettext-1.0.12-1.el6.noarch
            —> Package php-tcpdf.noarch 0:6.2.13-1.el6 will be installed
            –> Processing Dependency: php-xml for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-tidy for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-posix for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-mbstring for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-gd for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-composer(fedora/autoloader) for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-bcmath for package: php-tcpdf-6.2.13-1.el6.noarch
            —> Package php-tcpdf-dejavu-sans-fonts.noarch 0:6.2.13-1.el6 will be installed
            —> Package phpMyAdmin.noarch 0:4.0.10.19-1.el6 will be installed
            –> Processing Dependency: php-xmlwriter for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-mbstring for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-gd for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Running transaction check
            —> Package libmcrypt.x86_64 0:2.5.8-9.el6 will be installed
            —> Package php-fedora-autoloader.noarch 0:1.0.0-0.1.rc1.el6 will be installed
            —> Package php-php-gettext.noarch 0:1.0.12-1.el6 will be installed
            –> Processing Dependency: php-mbstring for package: php-php-gettext-1.0.12-1.el6.noarch
            —> Package php-tcpdf.noarch 0:6.2.13-1.el6 will be installed
            –> Processing Dependency: php-xml for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-tidy for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-posix for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-mbstring for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-gd for package: php-tcpdf-6.2.13-1.el6.noarch
            –> Processing Dependency: php-bcmath for package: php-tcpdf-6.2.13-1.el6.noarch
            —> Package phpMyAdmin.noarch 0:4.0.10.19-1.el6 will be installed
            –> Processing Dependency: php-xmlwriter for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-mbstring for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Processing Dependency: php-gd for package: phpMyAdmin-4.0.10.19-1.el6.noarch
            –> Finished Dependency Resolution
            Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
            Requires: php-posix
            Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
            Requires: php-xml
            Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
            Requires: php-bcmath
            Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
            Requires: php-tidy
            Error: Package: phpMyAdmin-4.0.10.19-1.el6.noarch (epel)
            Requires: php-gd
            Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
            Requires: php-gd
            Error: Package: phpMyAdmin-4.0.10.19-1.el6.noarch (epel)
            Requires: php-mbstring
            Error: Package: phpMyAdmin-4.0.10.19-1.el6.noarch (epel)
            Requires: php-xmlwriter
            Error: Package: php-php-gettext-1.0.12-1.el6.noarch (epel)
            Requires: php-mbstring
            Error: Package: php-tcpdf-6.2.13-1.el6.noarch (epel)
            Requires: php-mbstring
            You could try using –skip-broken to work around the problem
            You could try running: rpm -Va –nofiles –nodigest

          • @Mallory,

            Better remove all third party repositories and install PhpMyAdmin via epel repository only. The reason you getting these errors, as you having multiple repositories on the system.

  7. Hi, Please I have a problem, when I install PhpMyAdmen and I run command service httpd restart I get the below error.

    Starting httpd: httpd: Could not reliably determine the server's fully qualified domain name, using 192.0.0.0 for ServerName
    

    And I can’t access my http://192.0.0.0/PhpMyAdmen/

    Forbidden

    You don’t have permission to access /phpmyadmin on this server.

    Apache/2.2.15 (CentOS) Server at 192.0.0.0 Port 80

    Please help me!

    Reply
    • @Jocovish,

      That’s not error, it saying that the service could not determine the server full qualified hostname, to get rid of this error, try to add your system hostname in /etc/hosts file and then restart the httpd service..

      Regarding Forbidden error, you need allow you IP address to access PhpMyAdmin..

      Reply
  8. i am getting error : forbidden you don’t have permission to access /phpmyadmin on this server.
    apache/2.2.15 (Centos) server at 172.16.16.25 port 80

    Reply
    • @Kumar,

      In /etc/httpd/conf.d/phpMyAdmin.conf file, add the IP address of your machine as shown and restart Apache.

      Allow from your-ip-address
      
      Reply

Got something to say? Join the discussion.

Have a question or suggestion? Please leave a comment to start the discussion. Please keep in mind that all comments are moderated and your email address will NOT be published.