How to Manage or Access Multiple MySQL server using one PhpMyAdmin ?

phpMyAdmin is a free and open source tool written in PHP intended to handle the administration of MySQL with the use of a web browser. It can perform various tasks such as creating, modifying or deleting databases, tables, fields or rows; executing SQL statements; or managing users and permissions. In this tutorial I will show you how to configure PhpMyAdmin to administrate various MySQL database servers.

To install and run PhpMyAdmin we need to install LAMP stack or indivudual each component on the server. After complete installation we need to modify the PhpMyAdmin configuration file. 

1) If installed LAMP Statck Navigate to below path. Assume you installed LAMP
    in /opt directory.

         cd  /opt/lampp/phpmyadmin/

2) In not installed LAMP Stack then Navigate to below path.

         cd  /etc/phpmyadmin/

3) Open config.inc.php file using below command.

        sudo nano config.inc.php

4) Search for the below content:

// First server

$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;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;


5) Now we will add our external MySQL database server like the above pattern.

Append below lines to the config files.
   
// Second server

$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '192.168.2.100';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;

// Third server

$i++;
/* Authentication type */
$cfg['Servers'][$i]['auth_type'] = 'cookie';
/* Server parameters */
$cfg['Servers'][$i]['host'] = '192.168.2.101';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['compress'] = false;
/* Select mysql if your server does not have mysqli */
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['AllowNoPassword'] = false;


Finally we need to restart the Apache web server

    1) If installed LAMP       : sudo /opt/lamp/lamp restart

    2) If not installed LAMP : sudo service apache2 restart

Now you should be able to open the PHPmyAdmin via web browser at http://192.168.2.103/phpmyadmin . You can select MySQL servers you want to connect from the “Server Choice” drop box and access it using your credentials. Thanks!! 
Have Fun.
 


Comments

Popular posts from this blog

How to Install AnyDesk remote desktop client on Ubuntu

How to install Jaspersoft Studio on Eclipse

What is Advanced Encryption Standard (AEC) and online tool to encrypt and decrypt data using AEC.