Linuxing Celebrating Life with Linux

25Nov/090

How to use PhpMyAdmin for Multiple MySQL servers running on same server machine

Our community member, Jags, has posted an excellent how-to to run multiple mysql services on a single box. You can view the article here.
I've created multiple instances successfully following his straightforward steps. After that, I tried installing PhpMyAdmin to manage all these mysql servers running on the box. It was a bit tricky, therefore, I've posted the steps here for your reference:

After creating multiple Mysql services, you should install Apache (httpd) and PHP in case you dont have these one in your server yet. Then proceed to install PhpMyAdmin:

$ cd /var/www/html
$ wget http://downloads.sourceforge.net/project/phpmyadmin/phpMyAdmin/2.11.9.6/phpMyAdmin-2.11.9.6-english.tar.gz?use_mirror=nchc
$ tar xzf phpMyAdmin-2.11.9.6-english.tar.gz 
$ mv phpMyAdmin-2.11.9.6-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 server running on localhost. 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. If you have any query or question or idea for enhancement, pls post in thread dedicated for this script in our forums.

Share and Enjoy:
  • Print
  • Digg
  • del.icio.us
  • Facebook
  • Google Bookmarks
  • Add to favorites
  • Reddit
  • StumbleUpon
  • Twitter
Filed under: Database Leave a comment
Comments (0) Trackbacks (0)

No comments yet.


Leave a comment


No trackbacks yet.

Get Adobe Flash playerPlugin by wpburn.com wordpress themes