How to manage remote Mysql database with PhpMyAdmin

Here's the scenario:

The Mysql Database resides on a different server and connections can only be made via the web server.

The web server have PhpMyAdmin installed and now the requirement is to access the Mysql database from the internet (from specified IP addresses only)

Here's the web server setup:

Ubuntu Core with Apache, PHP and PhpMyadmin.

 

And here's what needs to be changed to ensure that the Mysql database can be access from these IP addresses:

 

change to user root

sudo su

 

Step I

make changes to the config.inc.php file

vi /etc/phpmyadmin/config.inc.php


Change the:

if (empty($dbserver)) $dbserver= 'add your server ip or hostname here'

Replace the 'add your server ip or hostname here' with relevant server value and save the file

Step II

Edit the phpmyadmin.conf file

vi /etc/apache2/conf.d/phpmyadmin.conf


Comment the line:

Alias /phpmyadmin /usr/share/phpmyadmin

Add the following lines after DirectoryIndex index.php

order deny,allow

All from 'your public ip address'

Replace the 'your public ip address' with relevant ip address and save the file

restart Apache service

service apache2 restart