How To Configure PHPMyAdmin to connect to Remote MySQL RDS

I’m doing this video based on a user suggestion. In some past tutorials on this channel we’ve walked through setting up a remote database service. Once using the Lightsail Database Service and another video on using the Amazon RDS service. In both the videos we move the WordPress database from the locally installed MySQL to the remote database service. The question from the user was, how to connect the PHPMyadmin tool to the remote database. By default PHPmyadmin is configured to only connect to locally installed MySQL database. So in this I will walk you through that setup.

Steps

Ok to get started, we are in our Lightsail dashboard. If you already have a Lightsail WordPress instance or a LAMP blueprint instance, both will have Phpmyadmin installed by Bitnami.

  1. Access you LAMP or WordPress instance.
  2. Setup SSH and SSH Tunnel in Bitvise
  3. Have a remote Database available
    1. This can be a Lightsail Database or Amazon RDS.
    2. Get the Endpoint URL
  4. SSH into the Server instance and open the PHPMyadmin config file
    1. File: config.inc.php
    2. Add this code just before the Default server section / parameter
$i++;
$cfg['Servers'][$i]['host'] = 'RDS_ENDPOINT_URL';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['socket'] = '';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
$cfg['Servers'][$i]['auth_type'] = 'cookie';

5. Restart Apache

sudo /opt/bitnami/ctlscript.sh restart apache