Quick Tip: How to Install phpMyAdmin

Assuming you already have mysql server installed on your machine, the reason you are
installing phpmyadmin is to ease  your administration of  your MySQL like database creation and deletion, create/alter/drop/view tables and execute any SQL statements, privilege and trigger management, stored procedures, and backup/ maintenance

phyMyAdmin is a tool built in PHP to manage and administer your MySQL servers via your browser.

Requirements:

1.PHP
2.MySQL
3.php-mysql
4.gd/gd-devel
5. Apache

1. Install the necessary requirements
ex:
[root@freelinuxtutorials src]# yum install php-mysql
Loaded plugins: fastestmirror
Loading mirror speeds from cached hostfile
* base: mirror.primusdatacentre.com.au
* updates: mirror.primusdatacentre.com.au
* addons: mirror.primusdatacentre.com.au
* extras: mirror.primusdatacentre.com.au
Setting up Install Process
Parsing package install arguments
Resolving Dependencies
–> Running transaction check
—> Package php-mysql.i386 0:5.1.6-23.2.el5_3 set to be updated
–> Processing Dependency: php-pdo for package: php-mysql
–> Running transaction check
—> Package php-pdo.i386 0:5.1.6-23.2.el5_3 set to be updated
–> Finished Dependency Resolution

Dependencies Resolved

================================================================================
Package           Arch         Version                   Repository       Size
================================================================================
Installing:
php-mysql         i386         5.1.6-23.2.el5_3          updates          85 k
Installing for dependencies:
php-pdo           i386         5.1.6-23.2.el5_3          updates          64 k

Transaction Summary
================================================================================
Install      2 Package(s)
Update       0 Package(s)
Remove       0 Package(s)

Total download size: 148 k
Is this ok [y/N]: y

2. Download and uncompress the distro kit from phpmyadmin.net download page

3.If you have PHP 5.2+ version. phpmyadmin version 3X is advised. You can download it in
http://www.phpmyadmin.net/home_page/downloads.php

sample:
[root@freelinuxtutorials src]#cd /usr/local/src
[root@freelinuxtutorials src]#wget

http://nchc.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/3.2.2/phpMyAdmin-3.2.2-all-languages.tar.bz2
[root@freelinuxtutorials src]# bunzip2 phpMyAdmin-3.2.2-all-languages.tar.bz2
[root@freelinuxtutorials src]# tar xvf phpMyAdmin-3.2.2-all-languages.tar

*for PHP 5.2 below,
[root@freelinuxtutorials src]#cd /usr/local/src
[root@freelinuxtutorials src]#wget

http://nchc.dl.sourceforge.net/project/phpmyadmin/phpMyAdmin/2.11.9.5/phpMyAdmin-2.11.9.5-all-languages-utf-8-only.tar.gz
[root@freelinuxtutorials src]#tar zxvf phpMyAdmin-2.11.9.5-all-languages-utf-8-only.tar.gz

4. Move and rename the extracted folder to your web server’s document root usually in

/var/www/html

sample:
[root@freelinuxtutorials src]# mv phpMyAdmin-2.11.9.5-all-languages-utf-8-only phpmyadmin
[root@freelinuxtutorials src]#cp -R phpmyadmin /var/www/html

5. Configure phpmyadmin

There are two ways to configure:

A. Manual Configuration

-Create a file called config.inc.php on sthe phpmyadmin main directory or you can copy the

config.sample.inc.php

[root@freelinuxtutorials src]#cp config.sample.inc.php config.inc.php

– Edit blowfish secret

// use any value here for blowfish_secret, max of 46 chars.
$cfg[‘blowfish_secret’] = ‘adf3fad107d65002’; /* YOU MUST FILL IN THIS FOR COOKI
E AUTH! */

// auth type can be “cookie” or “http”, you can put cookie in it esp. for testing and to

see some error messages if any
$cfg[‘Servers’][$i][‘auth_type’] = ‘cookie’;

/* Select mysqli if your server has it */
$cfg[‘Servers’][$i][‘extension’] = ‘mysql’;

//If you want password for “root”

To manually create the file, simply use your text editor to create the file config.inc.php

(you can copy config.sample.inc.php to get minimal configuration file) in the main

(top-level) phpMyAdmin directory (the one that contains index.php). phpMyAdmin first loads

libraries/config.default.php and then overrides those values with anything found in

config.inc.php. If the default value is okay for a particular setting, there is no need to

include it in config.inc.php. You’ll need a few directives to get going, a simple

configuration may look like this:

<?php
$cfg[‘blowfish_secret’] = ‘ba17c1ec07d65003’;  // use here a value of your choice

$i=0;
$i++;
$cfg[‘Servers’][$i][‘auth_type’]     = ‘cookie’;
?>

B. Via Setup Script

– Create a folder “config” in the phpmyadmin directory and set permissions

[root@freelinuxtutorials src]#cd /var/www/html/phpmyadmin
[root@freelinuxtutorials src]#mkdir config
[root@freelinuxtutorials src]#chmod o+rw config

– Edit config.inc.php
[root@freelinuxtutorials src]#cp config.inc.sample.php config.inc.php
[root@freelinuxtutorials src]#cp config.inc.php config/
[root@freelinuxtutorials src]#chmod o+w config/config.inc.php

– Now open setup thru your favorite browser, open http://machineIPaddress/phpmyadmin/setup

– Save changes under the configuration area.

– Once finished saving, move file to phpmyadmin directory and revert back the permission

for security purposes

[root@freelinuxtutorials src]#mv config/config.inc.php .
[root@freelinuxtutorials src]#chmod o-rw config.inc.php

6. Access now the phpmyadmin and use your mysql access to login
http://i.p.address/phpmyadmin

Note: You can setup an .htaccess in that folder for added security

Enjoy!

About the author

tux

View all posts

Leave a Reply