0

I cannot connect to Amazon RDS instance from a shared hosting or my computer's terminal but can access from a MySQL Client (Navicat).

PHP Fatal error: Uncaught Exception: SQLSTATE[HY000] [2002] Connection refused.

telnet dbname.xxxxxxxxxxx.ap-southeast-1.rds.amazonaws.com 8889 
Trying 13.251.196.229...
Connected to ec2-13-251-196-229.ap-southeast-1.compute.amazonaws.com.
Escape character is '^]'.
N
5.6.40-log?Q)xC$)BP?Jb1h:*b/b$'9mysql_native_password3CJNmxyPq6n4b5dZ
!#08S01Got packets out of orderConnection closed by foreign host.

Can you help find any solutions regarding this? Thanks!

Roshan
  • 786
  • 1
  • 9
  • 20
  • This is pretty generic to be specifically answered, check the security configuration on the RDS database. – namelivia Feb 13 '19 at 07:09
  • Telnet message is something expected (see e.g. https://stackoverflow.com/questions/10053613/apache-mysql-packets-out-of-order-on-3306), as for connection refused - make sure the RDS security groups are properly configured (https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/Overview.RDSSecurityGroups.html). Also are you using correct port on the PHP side (8889 is not a standard port for mysql). – Lech Migdal Feb 13 '19 at 09:15
  • @LechMigdal i've used port 3306 which came by default and still can't connect. – Shetu Olindo Feb 13 '19 at 09:48
  • Did you check your security groups? Connection refused usually suggests to check network configuration. – Lech Migdal Feb 13 '19 at 10:57
  • @LechMigdal boith inbounds and outbounds are Aurora/MySQL 0.0.0.0/0 and another inbound only at a separate ip. – Shetu Olindo Feb 16 '19 at 05:23
  • Are you connecting from within VPC? Just to make sure you're using the same IPs in all cases. Also you may want to check items as described https://aws.amazon.com/premiumsupport/knowledge-center/rds-cannot-connect/ – Lech Migdal Feb 16 '19 at 08:00

0 Answers0