PHPFixing
  • Privacy Policy
  • TOS
  • Ask Question
  • Contact Us
  • Home
  • PHP
  • Programming
  • SQL Injection
  • Web3.0

Friday, March 18, 2022

[FIXED] Connect to RDS via EC2 using phpMyAdmin

 March 18, 2022     amazon-ec2, amazon-rds, amazon-web-services, mysql, phpmyadmin     No comments   

Issue

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.


Solution

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



Answered By - CJW
  • Share This:  
  •  Facebook
  •  Twitter
  •  Stumble
  •  Digg
Newer Post Older Post Home

0 Comments:

Post a Comment

Note: Only a member of this blog may post a comment.

Total Pageviews

Featured Post

Why Learn PHP Programming

Why Learn PHP Programming A widely-used open source scripting language PHP is one of the most popular programming languages in the world. It...

Subscribe To

Posts
Atom
Posts
Comments
Atom
Comments

Copyright © PHPFixing