How to Add Multiple Hosts in phpMyAdmin?

Dev Singh. October 13, 2016 Comments

phpMyAdmin default configuration allows to connect to local mysql server only, But if we have multiple database server running, then it would be great if we can choose to which server we need to connect from single phpMyAdmin installation. This how to guide will help you to add multiple database hosts in phpMyAdmin, So we can select to which database server we need to connect from web interface.

After installing phpMyAdmin on your Linux/Windows systems, lets use this to manage multiple hosts from one phpMyAdmin install.

First navigate to your phpMyAdmin installation directory. Directory location may be differ with your installation method. In most case we can found it on /usr/share/phpMyAdmin or /usr/share/phpmyadmin directory.

# cd /usr/share/phpmyadmin
# cp
# vim

Now add the following entries at the end of file.

 $cfg['Servers'][$i]['verbose'] = 'Database Server 2';
 $cfg['Servers'][$i]['host'] = '';
 $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'] = true;
 $cfg['Servers'][$i]['user'] = 'db_user';
 $cfg['Servers'][$i]['password'] = 'admin';

$cfg['Servers'][$i]['auth_type'] = 'config';

It will authenticate from the config file and you have no need to login again and again.


After adding the above entries in configuration file and access phpMyAdmin in web browser and you will get an option of server choice. Select server name to which you need to connect.

  • phpMyAdmin
  • multiple-host
  • multiple-connections