You are here
phpMyAdmin and CentOS and EC2 and RDS – fixed! data networks and data Programming 

phpMyAdmin and CentOS and EC2 and RDS – fixed!

If you’re reading this and it matters to you.  I’m about to save you hours of go-nowhere research.  Nowhere else have i found the solution.  So here you go world.

I can describe the problem as this:  PHPMyAdmin apparently won’t work under Amazon’s EC2 instance of CentOS using RDS or some other TCP based SQL connection.

Maybe the problem description is too general in some places, and maybe too specific in others.  However, if you’ve “tried everything” and phpMyAdmin still won’t work for you, this is it.

Phpmyadmin.  What nightmare on Amazon Web Services EC2 CentOS when using with any remote TCP-based connection.

Here’s the tshoot that STOLE hours from me.  I’ve iterated, tested, and double check tested each one of these:


You’ve reviewed or tried changing file ownership or permissions.

You’ve doublechecked that the amazon security group is allowing port 3306.

You’ve ensured that iptables on the local system is not filtering.

You’ve tried modifying the phpMyAdmin config file.

  • RDS host using FQDN or IP address
  • port defined as 3306, or empty and trusting 3306 is default as it states
  • connection type tcp, cause socket is for local databases only (non tcp)
  • any and all authentication types (config / cookie / http)
  • compress TRUE/false
  • user/password

You’ve questioned the location and permissions of /etc/phpMyAdmin/

You’ve considered reinstalling the non-yum repository of phpMyAdmin, but you’re not there yet.

You’ve tried examining the php.ini file to see if there’s any clues or something there.

You’ve reconfigured php.ini to output the MAXIMUM debug logs possible for some clue.

You’ve reconfigured apache to output the MAXIMUM debug logs possible for some clue.

You’ve scanned system and apache logs for some clue as to why it’s not working with no luck.

You’ve done manual mysql client lookups to ensure the username and password are correct.

You’ve done tcpdumps on port 3306 and have seen nothing.  You’ve done tcpdumps on port 3306 while doing manual mysql client lookups to make sure that tcpdump would indeed see the traffic.  That works, but doesn’t work when phpMyAdmin should be initiating port 3306 traffic.

Now do this:

Disable SELINUX and reboot your whole instance! change it from enforcing to permissive.  Done.  You’re fixed so long as you didn’t mangle anything doing all of the above mentioned steps 😉


[root@ip-172-31-17-103 phpMyAdmin]# cat /etc/selinux/config

# This file controls the state of SELinux on the system.
# SELINUX= can take one of these three values:
# enforcing – SELinux security policy is enforced.
# permissive – SELinux prints warnings instead of enforcing.
# disabled – No SELinux policy is loaded.
# SELINUXTYPE= can take one of three two values:
# targeted – Targeted processes are protected,
# minimum – Modification of targeted policy. Only selected processes are protected.
# mls – Multi Level Security protection.

Related posts

One thought on “phpMyAdmin and CentOS and EC2 and RDS – fixed!

  1. Thanks so much for the warning and the fix! What a nightmare is right. Doing some contract work in Asia LOS so happy for the assistance!

Leave a Comment