Install and configure PhpMyAdmin to manage multiple MySQL Servers

by jagbir on March 31, 2011

If you have read and implemented my previous article: how to run multiple MySQL services on a single box, you may like to manage such multiple installation of MySQL or multiple separate MySQL hosts by using a single PhpMyAdmin installation. This is easy enough to do quickly.

I assume you have Apache (httpd) and PHP installed where you want to setup PhpMyAdmin. Let’s proceed to install PhpMyAdmin:

$ cd /var/www/html
$ wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/2.11.11.3/phpMyAdmin-2.11.11.3-english.tar.gz?use_mirror=nchc
$ tar xzf phpMyAdmin-2.11.11.3-english.tar.gz 
$ mv phpMyAdmin-2.11.11.3-english phpmyadmin
$ cd phpmyadmin

You can of course, download and install PhpMyAdmin automatically using Yum, but here I’ve installed it manually. Now make a config file for it and update that:

$ cp config.sample.inc.php config.inc.php
$ vim !$

in the configuration file, set blowfish_secret to some random value and update config to connect two MySQL servers running on localhost or separately in different hosts. You can add any number of Servers in this config file. For 2 hosts, at the end of editing your config file should be like below:

$cfg['blowfish_secret'] = 'W3lC0m3'; /* YOU MUST FILL IN THIS FOR COOKIE AUTH! */
 
/*
 * Servers 1 configuration, running on default port 3306
 */
$i = 0;
 
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
 
/*
 * Servers 2 configuration, running on port 5141
 */
 
$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['port'] = '5141';
$cfg['Servers'][$i]['socket'] = '/tmp/mysql_sandbox5141.sock';
$cfg['Servers'][$i]['connect_type'] = 'socket';
$cfg['Servers'][$i]['compress'] = false;

save file and exit from vim.

Now open your browser and access PhpMyAdmin: http://yourserverip/phpmyadmin You will see that in host list there are two servers, select anyone and enter MySQL username/password. Now using PhpMyAdmin you can manage both servers.

  • Madhan

    Please resolve this its not working.. :(

    • jagbirs

      Hi Madhan, What’s the error you are getting? Could you check you have configured it as shown in article?

Previous post:

Next post: