How to access remote mysql server using local phpmyadmin

Posted on February 28, 2014 by Suresh Kamrushi in Mysql, PHP

It is very tedious to connect your remote mysql box especially when you are working with VPN. Initially I used telnet to connect to mysql box than I try to use workbench. Workbench is good and better than using telnet but again it consume more memory and if VPN got disconnected it just hanged. It so irritating.
Than I try to configure my PHPMyAdmin to access remote mysql server and it is really very easy to setup. Just you need to configure/modify a single in PHPMyAdmin folder i.e. “config.inc.php”.
Just add below lines to your “config.inc.php” file add the bottom:

$i++;
$cfg['Servers'][$i]['host'] = 'HostName:port'; //provide hostname and port if other than default
$cfg['Servers'][$i]['user'] = 'userName'; 	//user name for your remote server
$cfg['Servers'][$i]['password'] = 'Password';  //password
$cfg['Servers'][$i]['auth_type'] = 'config';       // keep it as config

If your mysql server is in remote than make sure that you are very much connected to box and than try to access PHPMyAdmin using url. You will get “Current Server:” drop down with both “127.0.0.1” and one what you have provided with “$cfg[‘Servers’][$i][‘host’]” cam switch between the servers.
Click to See the demo screen:

phpmyadmin

phpmyadmin

My PHPMyAdmin version: 4.0.4.1
My MySql Version: 5.5

  Comments or questions are welcome  

Tagged as , ,