[HOWTO] Install phpMyAdmin in CentOS 5

I am using CentOS 5 in one of my Virtual Servers and I wanted it to have phpMyAdmin. I tried installing it by doing yum install phpmyadmin but it said No package phpmyadmin available. So I add to add a repo. I discovered that rpmforge repo had this package. To add it, I executed the following commands:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.i386.rpm
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.i386.rpm

If you have 64-bit version installed, you should try this one out:

wget http://packages.sw.be/rpmforge-release/rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm
rpm -Uhv rpmforge-release-0.5.1-1.el5.rf.x86_64.rpm

If you get a 404 Not Found, then you will need to figure out the latest updated version of repo url from rpmforge usage page.

After that, you may like to update your packages by doing this:

yum update

and then continue installing phpmyadmin

yum install phpmyadmin

It should ask you for confirmation and you can continue installing phpMyAdmin with dependencies.

When installation is done, you can edit /etc/httpd/conf.d/phpmyadmin.conf and allow it to be opened from anywhere and not just the same computer. You are going to need this if you have installed it in a remote virtual server.
To do so, open up /etc/httpd/conf.d/phpmyadmin.conf using:

nano /etc/httpd/conf.d/phpmyadmin.conf

You will see:

<Directory "/usr/share/phpmyadmin">
  Order Deny,Allow
  Deny from all
  Allow from

Just change the line “Allow from” to “Allow from [yourip]”, where [yourip] is IP address of your computer if you have public static IP. Otherwise, you can also set it to “Allow from all”.
Press Ctrl+O followed by Enter to save and Ctrl+X to exit nano.

Now, you must restart apache. To do so, run

service httpd restart

Now, you can access phpMyAdmin by visiting http://vps_server_IP_or_domain/phpmyadmin. But you will get the following error:

The configuration file now needs a secret passphrase (blowfish_secret).

To make it work, you will need to edit config.inc.php. To do so, type in:

nano /usr/share/phpmyadmin/config.inc.php

Find a line saying:

$cfg['blowfish_secret'] = ''; /* YOU MUST FILL IN THIS

Fill in any secret keyword there, eg mysecretpassphrase, so that it looks like:

$cfg['blowfish_secret'] = 'mysecretpassphrase'; /* YOU MUST FILL IN THIS

and then save it.

If you don’t have mysql server installed, you will get the following error:

#2002 – The server is not responding (or the local MySQL server’s socket is not correctly configured)

To install mysql-server, just run:

 yum install mysql-server

and then start it:

 service mysqld start

Then change the root password:

mysqladmin -u root password PASSWORD_HERE

Now, you will have to remove phpmyadmin:

yum remove phpmyadmin

and reinstall it again:

yum install phpmyadmin

Then you will need to edit the config.inc.php again to enter blowfish secret (see above). Then, you can login.

If however, you want phpMyAdmin to connect to a remote server, you can change the line by replacing localhost with your server IP:

$cfg['Servers'][$i]['host'] = 'localhost';

Hope this helps.

  • Gurungnimesh

    Saved me headache esp when time is of the essence.

  • Abhimanyu M A

    Isn’t it better to ensure whether you have mysql installed or not and then install phpmyadmin ??
    Don’t see the logic in installing, checking, removing and reinstalling..

    • Of course. I should have made it clear that if you wish to use the same server, then you will need to install mysql-server in advance.

  • Karthik


    I tried your way, but I again got No package phpmyadmin available error. So can you help me what to do now ?

  • Prem Panwar

    Thanks Bro.its very helpfull for me

  • Chris

    great! Works. Don’t quiet understand why you reinstalled phpmyadmin. This is not necessary.

  • thousand thank for posting this good article, i have follow all tutorial and blufff, in the final, i got my phpmyadmin working on my vps. kind regard

  • thousand thank for posting this good article, i have follow all tutorial and blufff, in the final, i got my phpmyadmin working on my vps. kind regard

  • neenu

    installed and when accessing it shows password wrong how change password

  • Sonidhaval


    I am getting below error after following above steps on centos 5.6.

    Cannot start session without errors, please check errors given in
    your PHP and/or webserver log file and configure your PHP installation



    • Please locate your php.ini file (you’ll probably find it in /etc/php.ini).. look for  session.save_path and make sure that path has proper permission (try 1755) and ownership (try phpmyadmin:phpmyadmin).. Please let me know if anything.

  • Amar

    Very Beauty full tutorial.. Among the best.. helped me a lot.. Thankou for this hard work…

  • Datdit

    it’s work , thank very much

  • Energyshock1

    man thank you !

  • m.vashadze

    Unable to connect
              Firefox can’t establish a connection to the server at
      The site could be temporarily unavailable or too busy. Try again in a few

      If you are unable to load any pages, check your computer’s network

      If your computer or network is protected by a firewall or proxy, make sure
        that Firefox is permitted to access the Web.

  • Pingback: [GUIDE] How to install PhpMyAdmin into your Debian 6 VPS()

  • Zend

    Thank you this is the best tutorial for install phpmyadmin on centos 6

    • Zend

      I mean centos 5

  • Ramaraju Dantuluri

    I followed the tutorial, Yet the same problem repeated. It says No Package phpMyadmin available. Any idea ? I am on centOs 6. executing commands via putty

    • andru

      Not so far I have found new cool tool to work with mySQL – Valentina Studio. Its free edition can do things more than many commercial tools!!
      I very recommend check it. http://www.valentina-db.com/en/valentina-studio-overview

    • RagnarokXIX

      You should ask google what is the correct packages for Centos 6.

  • RagnarokXIX

    Great tutorial.. works like a charm!! Thanks!!

  • Rohit

    hi i need to block url in phpmyadmin i.e http://servername:8080/phpmyadmin/themes/
    i tried it by changing httpd.conf file

    Order Deny,Allow
    Deny from all

    but it is not working ….please help so that i can do it.
    !!!!NEED URGENT REPLY !!!!