How To Manage Remote Mysql From PHPMyAdmin

PHPMyAdmin supports the administration of multiple MySQL servers. You can access your remote MySQL databases from your localhost this need only few changes in PHPMyAdmin configuration.

$cfg['Servers']-array has been added which contains the login information for the different servers. The first $cfg['Servers'][1]['host'] contains the hostname of the first server, the second $cfg['Servers'][2]['host'] the hostname of the second server, etc. However you can put server definition as many as you need in config.inc.php in Ubuntu you will found file config.inc.php in /etc/phpmyadmin folder.

In order to connect to another server, you would have to add another set of config options to the config array. A set of config options would look something similar to this:

$cfg['Servers'][1]['host'] = ' ';
$cfg['Servers'][1]['connect_type'] = 'tcp';
$cfg['Servers'][1]['extension'] = 'mysql';
$cfg['Servers'][1]['controluser'] = ' ';
$cfg['Servers'][1]['controlpass'] = ' ';

There are lots of configuration parameters available check http://docs.phpmyadmin.net/en/latest/config.html

Find the section marked ‘Server Configuration’

add your server configuration in between the $i = 0;  and  $i++;

$i = 0;
$cfg['Servers'][1]['host'] = 'server1';
$cfg['Servers'][1]['connect_type'] = 'tcp';
$cfg['Servers'][1]['extension'] = 'mysql';
$cfg['Servers'][1]['port'] = '3306';
$cfg['Servers'][1]['controluser'] = 'myuser';
$cfg['Servers'][1]['controlpass'] = 'secretepassword';

$cfg['Servers'][1]['host'] = 'server2';
$cfg['Servers'][1]['connect_type'] = 'tcp';
$cfg['Servers'][1]['extension'] = 'mysql';
$cfg['Servers'][1]['port'] = '3306';
$cfg['Servers'][1]['controluser'] = 'myuser';
$cfg['Servers'][1]['controlpass'] = 'secretepassword';

$i++;

You need to change on more file config-db.php in /etc/phpmyadmin folder which is automatically generated at the time of phpMyAdmin installation. The file would look something similar to this

$dbuser='phpmyadmin';
$dbpass='root';
$basepath='';
$dbname='phpmyadmin';
$dbserver='localhost';
$dbport='3306';
$dbtype='mysql';

After change it should look something similar to this

$dbuser=' ';
$dbpass=' ';
$basepath=' ';
$dbname=' ';
$dbserver=' ';
$dbport=' ';
$dbtype='mysql';

Restart apache service

sudo service apache2 restart

Sample config-inc-php file

phpMyAdmin

Now there is a ‘Server Choice’ drop-down on your phpMyAdmin front page. Pick your sever and bingo !

Hope you find this tutorial helpful. Feel free to ask questions! Don’t forget to like or to leave a comment if its really help you.

Advertisements

2 thoughts on “How To Manage Remote Mysql From PHPMyAdmin”

  1. Thank you for the auspicious writeup. It in truth used to
    be a enjoyment account it. Glance complicated to more
    delivered agreeable from you! However, how can we be in contact?

    Like

Leave a Reply

Fill in your details below or click an icon to log in:

WordPress.com Logo

You are commenting using your WordPress.com account. Log Out / Change )

Twitter picture

You are commenting using your Twitter account. Log Out / Change )

Facebook photo

You are commenting using your Facebook account. Log Out / Change )

Google+ photo

You are commenting using your Google+ account. Log Out / Change )

Connecting to %s