July 30, 2014

How to Install phpMyAdmin on CentOS

phpMyAdmin Logo

With phpMyAdmin you can easily handle your MySQL databases through a web interface. This web interface is almost as powerful as the MySQL Command-Line tool. You can execute SQL statements, create, modify and delete databases, tables, fields or rows and manage users or permissions.

Root access is required to edit the following files and to execute commands. Log in as root (su) or simply prepend sudo to all commands that require root privileges.

Install phpMyAdmin

Install phpMyAdmin with YUM. This instruction assumes that you have a MySQL server running. You can install the MySQL server with yum install mysql-server, start it with service mysqld start and set a root password with mysqladmin -u root password PASSWORD.

yum install phpmyadmin

If YUM answers with “No package phpmyadmin” you need to add a new repository. On CentOS 6 the EPEL repository holds the phpMyAdmin package. The following repository is for CentOS 6 with 64 bit. Please replace the repository if necessary.

rpm -Uvh ftp://mirror.switch.ch/pool/1/mirror/epel/6/x86_64/epel-release-6-5.noarch.rpm

Run the following command to update all packages. Then you can try to install phpMyAdmin again.

yum update

After you have successfully installed phpMyAdmin open the file phpmyadmin.conf.

vi /etc/httpd/conf.d/phpmyadmin.conf

Then you will see the following lines:

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

Replace 127.0.0.1 from “Allow from 127.0.0.1″ with your IP or set it to all. Save the file and restart your Apache with:

service httpd restart

Now, you can access phpMyAdmin by opening http://your_IP/phpmyadmin. If you get this error: “The configuration file now needs a secret passphrase (blowfish_secret).” then you need to edit the config.inc.php.

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

Find the following line, replace PASSWORD with your password and save the file.

$cfg['blowfish_secret'] = 'PASSWORD';

Now you’re ready to start working with phpMyAdmin.

  • John

    hit :wq

    to Write and Quit the file (it will save before quitting)