How to access remote MySql database from localhost

I had this requirement from long to access my remote MySql database (hosted on some service provider, for which I had access to control panel only) from my localhost. This was not for the fun, but it’s really convenient if we can access remote database locally. Once one of my friend configured on my laptop for me, but I never know, how this worked. Then I formatted my laptop and all the settings were gone.

Today, one of my colleagues asked me to solve the same problem for him and I cracked for him, which I never tried for myself. So, the steps for configuring the remote database on local machine is as follows:

  1. Grab a copy of phpmyadmin from app folder of your WAMP (on MAC, you can find phpmyadmin in bin folder of you MAMP installation). Put all the files into root folder of your localhost, so that it can be accessed via http://localhost/new-phpmyadmin/
  2. Open the “config.inc.php” file from above setup in any text editor.
  3. Now configure these values:
  • $cfg[‘Servers’][$i][‘host’] = “IP address of your remote server”; //
  • $cfg[‘Servers’][$i][‘port’] = ‘3306’;
  • $cfg[‘Servers’][$i][‘user’] = ‘MySql username’;
  • $cfg[‘Servers’][$i][‘password’] = ‘MySql password’;

And this is all, what it takes to configure the localhost to access remote MySql database. It worked like magic for me, and was very relaxing for my colleague.

Please let me know, if it does not work for you.


Leave a Reply

Your email address will not be published. Required fields are marked *