Connecting phpMyAdmin with AWS RDS MySQL Instance
This blog explains how to install phpMyAdmin on Ubuntu 20.04 Server and connect the same with your AWS RDS MySQL instances. You can also use following method on any previous Ubuntu release.
- Log in to Ubuntu server with root user using SSH client.
- Update the operating system with the latest packages.
sudo apt-get update
- Install phpMyAdmin using the command
sudo apt-get -y install phpmyadmin
- On the configuration screen, select the web server that should be automatically configured. In our case select Apache2 and then press “OK” and hit Enter.
- The next screen which asks, “want to configure the database for phpMyAdmin with dbconfig-common?”. Select “Yes” and hit Enter.
- On the next screen, enter the administrative MySQL root password and hit Enter.
- The final screen asks you to provide a password specifically for phpMyAdmin. This password will be used to log in. After selecting a password, hit Enter to continue.
Configuring Apache 2 & phpMyAdmin
- Once phpMyAdmin is installed, configure the apache.conf file by adding following line to the bottom.
sudo vi /etc/apache2/apache2.conf
The lines you will need to add are:
# phpMyAdmin Configuration
- Edit the configuration file for phpMyAdmin. Add AWS RDS endpoint and other server configurations
Sudo vi /etc/phpMyAdmin/config.inc.php
$i++; $cfg['Servers'][$i]['host'] = 'RDS MYSQL ENDPOINT';//Enter IP address or hostname $cfg['Servers'][$i]['compress'] = false; $cfg['Servers'][$i]['AllowNoPassword'] = false; $cfg['Servers'][$i]['connect_type'] = 'tcp'; $cfg['Servers'][$i]['extension'] = 'mysqli'; // Extension to connect to the database. $cfg['Servers'][$i]['port'] = ''; //The port number of MySQL service $cfg['Servers'][$i]['user'] = ''; // Username to connect $cfg['Servers'][$i]['password'] = ''; //Password associated with the username
- Restart the apache service
sudo service apache2 restart
RDS Security Group
In RDS Security group open inbound port 3306 to give phpMyAdmin access to MySQL. You can give which IP address of the server where phpMyAdmin is installed in the Security group.
Now log in to phpMyAdmin using the password you created by visiting the URL: https:///phpmyadmin.