Published September 19, 2018 by

Connect AWS RDS MySQL instance with phpMyAdmin

In this tutorial, we will learn how to connect AWS RDS MySQL server with phpMyAdmin.


Follow below steps to configure:


Step 1:
Install Apache Web Server
sudo apt-get update -y
sudo apt-get install apache2 -y
sudo systemctl start apache2.service
Verify that Apache was installed without errors by accessing it from your local browser. Enter http://SERVER_IP/

Step 2:
Install PHP
sudo apt-get install php -y
sudo apt-get install -y php-{bcmath,bz2,intl,gd,mbstring,mcrypt,mysql,zip} 
sudo apt-get install libapache2-mod-php  -y
Step 3:
Restart Apache
systemctl restart apache2.service
Step 4:
Install and configure phpMyAdmin
cd /var/www/html/
Download phpMyAdmin from an authorized website using wget command
wget https://files.phpmyadmin.net/phpMyAdmin/4.7.3/phpMyAdmin-4.7.3-all-languages.zip
Unzip phpMyAdmin
unzip phpMyAdmin-4.7.3-all-languages.zip
Rename phpMyAdmin and go to phpMyAdmin folder
mv phpMyAdmin-4.7.3-all-languages phpmyadmin
cd phpmyadmin
Edit the configuration file for phpMyAdmin.
vim config.sample.inc.php
Below is a default file
/* Server parameters */ 
$cfg['Servers'][$i]['host'] = 'localhost';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
Now, edit this file according to below file
/* Server parameters */
$cfg['Servers'][$i]['host'] = 'RDS MYSQL ENDPOINT';
$cfg['Servers'][$i]['compress'] = false;
$cfg['Servers'][$i]['AllowNoPassword'] = false;
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysqli';
Save file and Close.

You can get 'RDS MYSQL ENDPOINT' from AWS RDS console. 


Step 5:
Restart Apache
systemctl restart apache2.service
Step 6:
Open inbound port 3306 in RDS Security group for access MySQL to phpMyAdmin. you can give which IP where phpMyAdmin is installed in Security group.

Step 7:
Access phpMyAdmin from your local browser. Enter http://SERVER_IP/phpMyAdmin 
enter username and password of your RDS. and access it.