How to Install phpMyAdmin on CentOS 6.2 Server


Share this Article :

phpMyAdmin is a free software written in PHP intended to handle the administration of MySQL over the World Wide Web. It can manage a whole MySQL server (needs – super user ) and database. phpMyAdmin supports a wide range of operations with MySQL. The most frequently used operations are supported by the user interface (managing databases, tables, fields, relations, indexes, users, permissions, etc), while you still have the ability to directly execute any SQL statement. In this article, I will explain step how to install phpMyAdmin on CentOS 6.2.

How to Install Httpd on CentOS 6.2
How to Install MySQL Database Server on CentOS 6.2
How to Secure MySQL Database Server

1. Install Php :

[[email protected] ~]# yum install php php-mbstring php-mysql php-pdo php-cli php-common -y

2. To fix mcrypt not loaded warning on phpMyAdmin later on, kindly install php-mcrypt using the following steps and commands :

[[email protected] ~]# wget http://download.fedora.redhat.com/pub/epel/6/i386/epel-release-6-5.noarch.rpm
[[email protected] ~]# wget http://ftp.riken.jp/Linux/fedora/epel/RPM-GPG-KEY-EPEL-6
[[email protected] ~]# rpm --import RPM-GPG-KEY-EPEL-6
[[email protected] ~]# rpm -i epel-release-6-5.noarch.rpm
[[email protected] ~]# yum install php-mcrypt -y

3. Download phpMyAdmin :

[[email protected] ~]# wget http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.9/phpMyAdmin-3.4.9-all-languages.tar.gz
--2012-02-08 19:39:45--  http://sourceforge.net/projects/phpmyadmin/files/phpMyAdmin/3.4.9/phpMyAdmin-3.4.9-all-languages.tar.gz/download
Resolving sourceforge.net... 216.34.181.60
Connecting to sourceforge.net|216.34.181.60|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.9/phpMyAdmin-3.4.9-all-languages.tar.gz?r=&ts=1328701188&use_mirror=cdnetworks-kr-1 [following]
--2012-02-08 19:39:46--  http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.9/phpMyAdmin-3.4.9-all-languages.tar.gz?r=&ts=1328701188&use_mirror=cdnetworks-kr-1
Resolving downloads.sourceforge.net... 216.34.181.59
Connecting to downloads.sourceforge.net|216.34.181.59|:80... connected.
HTTP request sent, awaiting response... 302 Found
Location: http://cdnetworks-kr-1.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.9/phpMyAdmin-3.4.9-all-languages.tar.gz [following]
--2012-02-08 19:39:47--  http://cdnetworks-kr-1.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.4.9/phpMyAdmin-3.4.9-all-languages.tar.gz
Resolving cdnetworks-kr-1.dl.sourceforge.net... 211.39.135.162
Connecting to cdnetworks-kr-1.dl.sourceforge.net|211.39.135.162|:80... connected.
HTTP request sent, awaiting response... 200 OK
Length: 5763130 (5.5M) [application/x-gzip]
Saving to: âphpMyAdmin-3.4.9-all-languages.tar.gzâ

100%[==========================================================>] 5,763,130   39.4K/s   in 91s

2012-02-08 19:41:18 (62.2 KB/s) - âphpMyAdmin-3.4.9-all-languages.tar.gzâ

4. Copy phpMyAdmin-3.4.9-all-languages.tar.gz to DocumentRoot and extract the tar file. Make phpMyAdmin-XX executable. Create config folder and make it writable :

[[email protected] ~]# mv phpMyAdmin-3.4.9-all-languages.tar.gz /var/www/html/
[[email protected] ~]# cd /var/www/html/
[[email protected] html]# tar -xzvf phpMyAdmin-3.4.9-all-languages.tar.gz
[[email protected] html]# chmod 655 phpMyAdmin-3.4.9-all-languages/
[[email protected] html]# mv phpMyAdmin-3.4.9-all-languages phpmyadmin
[[email protected] html]# cd phpmyadmin

5. Copy config.sample.inc.php into config.inc.php. config.inc.php will be the main configuration file :

[[email protected] phpmyadmin]# cp config.sample.inc.php config.inc.php

6. Create phpmyadmin database :

mysql> CREATE DATABASE phpmyadmin;
Query OK, 1 row affected (0.00 sec)

7. Create the pma user and give access to databse and tables :

mysql> CREATE USER 'pma'@'localhost' IDENTIFIED BY 'pmapassword';
Query OK, 0 rows affected (0.00 sec)

mysql> GRANT ALL PRIVILEGES ON phpmyadmin.* to [email protected];
Query OK, 0 rows affected (0.00 sec)

8. Import the create_tables.sql into phpmyadmin database :

[[email protected] ~]# mysql -u pma -p -h localhost phpmyadmin < /var/www/html/phpmyadmin/scripts/create_tables.sql
Enter password:

Now, the "phpmyadmin" database has been created, and also the user "pma" exists with that password, that user has all privileges on DB "phpmyadmin" and has all privileges on all tables.

9. Edit configuration file as below :

[[email protected] ~]# vi /var/www/html/phpmyadmin/config.inc.php

9.1 Modify config.inc.php and add blowfish_secret as below :

$cfg['blowfish_secret'] = [email protected]'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */

9.2 Please change auth_type to “cookie” :

/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';

9.3 Enable advanced features in configuration file as below. Uncomment the below lines :

/*
 * phpMyAdmin configuration storage settings.
 */

/* User used to manipulate with storage */
$cfg['Servers'][$i]['controluser'] = 'pma';
$cfg['Servers'][$i]['controlpass'] = 'pmapassword';

/* Storage database and tables */
$cfg['Servers'][$i]['pmadb'] = 'phpmyadmin';
$cfg['Servers'][$i]['bookmarktable'] = 'pma_bookmark';
$cfg['Servers'][$i]['relation'] = 'pma_relation';
$cfg['Servers'][$i]['table_info'] = 'pma_table_info';
$cfg['Servers'][$i]['table_coords'] = 'pma_table_coords';
$cfg['Servers'][$i]['pdf_pages'] = 'pma_pdf_pages';
$cfg['Servers'][$i]['column_info'] = 'pma_column_info';
$cfg['Servers'][$i]['history'] = 'pma_history';
$cfg['Servers'][$i]['tracking'] = 'pma_tracking';
$cfg['Servers'][$i]['designer_coords'] = 'pma_designer_coords';
$cfg['Servers'][$i]['userconfig'] = 'pma_userconfig';
/* Contrib / Swekey authentication */
// $cfg['Servers'][$i]['auth_swekey_config'] = '/etc/swekey-pma.conf';

/*
 * End of servers configuration

10. You can start using phpMyAdmin :

http://ipaddress/phpmyadmin

Like this Article? Subscribe to Our Feed!

6 Comments

  1. Alex
  2. mhstar
    • Alex
  3. Alex

Leave a Reply