0
votes

I am trying to connect to an RDS instance using phpMyAdmin running on an EC2 instance. The error I am getting is: Cannot log in to the MySQL server.

I have scoured the other posts on this topic but none of the solutions have helped.

My set-up is:

CentOS Linux release 7.7.1908 (Core)

phpMyAdmin-4.4.15.10-4

5.5.64-MariaDB

PHP 5.4.16

Here is what I have tried so far: I can connect to the RDS instance via the MySQL Client CLI on the EC2 Instance My /etc/phpMyAdmin/config.inc.php contains the following:

$i++;
$cfg['Servers'][$i]['host'] = 'myrdshere.eu-west-2.rds.amazonaws.com';
$cfg['Servers'][$i]['port'] = '3306';
$cfg['Servers'][$i]['connect_type'] = 'tcp';
$cfg['Servers'][$i]['extension'] = 'mysql'; # I have tried with mysqli as well
$cfg['Servers'][$i]['compress'] = TRUE;

I have tried hard coding the username and password into the config.inc.php file. My RDS instance is configured to accept all traffic from the EC2 instance (confirmed as I can access RDS via the CLI)

I have amended /usr/share/phpMyAdmin/libraries/config.default.php to contain the server details.

I have rebooted the RDS instance.

More details on my set-up: I have my domain pointing to the EC2 instance so I am accessing phpMyAdmin via http://mydomain/phpmyadmin using Google Chrome.

My public IP has got all traffic allowed in and out of the EC2 instance.

I am at a complete loss of what else to try here. Does anyone have any ideas?

Cheers.

1

1 Answers

0
votes

Found my issue, I had to run the following: setsebool -P httpd_can_network_connect=1