Windows client use phhpmyadmin and putty with ssh tunnel to connect to remote mysql server from Internet


Objective: Windows client use phhpmyadmin and putty with ssh tunnel to connect to remote mysql server from Internet
Environment:  Windows xp, putty and xampp
Concept:  Use phpmyadmin from xampp on Windows (http://localhost/xampp) to connect to remote mysql server. As the server is not allowed to be connected to port 3306 directly, we use putty on Windows to do ssh tunnel as we are able to ssh into that server.


Steps:

1.   Install xampp for Windows from apache friends website http://www.apachefriends.org/en/xampp.html


2.  modify c:\xampp\phpmyadmin\config.inc. Change auto type from 'config' to 'cookie' to enable password prompt to login. Change username and server host accordingly.( Since we use port forwarding, server host should be localhost instead of the real remote server hostname)

3. start up apache service .

4. use putty to configure ssh port forwarding for port 3306.
source port :3306
Destination: remoteservername:3306

5. change remote mysql server user password
ssh into the server
mysql -u jephe -p -h serverhostname
mysql> set password = password('plainpasswordstring');

or you can use phpmyadmin to change password at homepage after login

6. use browser to access http://localhost/xampp/, then click on phpmyadmin on left side.

Note:
a. if you need to configure another server in phpmyadmin for home putty ssh tunnel use, then at the end of the server configuration part in config.rc, put


$i++;
$cfg['Servers'][$i]['host']             = 'localhost';


then you can choose this server from phpmyadmin web page after login putty ssh tunnel.