Friday, June 1, 2018

Access multiple database server from phpMyAdmin


Once phpMyAdmin is installed by default it is configured to access the local database. If we want to access the remote database we have to edit the phpMyAdmin configuration.  In linux environment configuration file is mostly available in  /etc/phpMyAdmin/config.inc.php

To connect the remote database we have to change the host name in the configuration file.

$cfg['Servers'][$i]['host']          = <<Server Name>>

To configure multiple database server
Add the following entries at the end of the file.

$i++;
 $cfg['Servers'][$i]['verbose'] =  <<Name which you want appear in the drop down>>
 $cfg['Servers'][$i]['host'] = <<Database server name or Ip Address>>
 $cfg['Servers'][$i]['port'] = '';
 $cfg['Servers'][$i]['socket'] = '';
 $cfg['Servers'][$i]['connect_type'] = 'tcp';
 $cfg['Servers'][$i]['extension'] = 'mysqli';
 $cfg['Servers'][$i]['auth_type'] = 'cookie';
 $cfg['Servers'][$i]['AllowNoPassword'] = false;

Once you have added this line,  Now we can see a Server dropdown in the phpMyAdmin login page.  Select the server name and appropriate password to login.