0

I have a EC2 Instance with apchane, PHP and phpmyadmin. I have connect phpmyadmin to manage the aws RDS server. they are in the same security group. But when i try to use a php script to connect to the AWS rds server, it gave me SQLSTATE[HY000] [2003] Can't connect to MySQL server on (xxx.xxx.xxx.xxx).

I did some researched, and most of them says use setsebool -P httpd_can_network_connect=1 reference: http://www.filonov.com/2009/08/07/sqlstatehy000-2003-cant-connect-to-mysql-server-on-xxx-xxx-xxx-xxx-13/

But i have no idea which server to configure? and how to?

2
  • What's apchane? Did you by chance mean apache or something? Jun 28, 2013 at 9:32
  • yes, i meant apache. typo, sorry.
    – Eugene Lim
    Jul 10, 2013 at 2:02

1 Answer 1

1

You're going down the wrong path with this. The root cause is that you can't connect to the SQL server from the node you're using the PHP script on.

Check your firewalls to make sure you can contact it on the right port (the default is 3306, but you may have chosen something else), that you have the right IP (it happens), and that it is listening on the interface you're trying to use to connect to it.

If you are using selinux, you will need to do something along the lines of setsebool -P httpd_can_network_connect=1. However, I don't often see people run selinux and phpmyadmin at the same time, so I'm going to guess you aren't. If it does happen that you are, though, this policy needs to be set on the server running httpd (apache) because that is the software to which it will apply (by enabling it to connect to network hosts).

1
  • it seems like some of the security settings is wrong. thanks for the help. cheers.
    – Eugene Lim
    Jul 10, 2013 at 2:04

You must log in to answer this question.

Not the answer you're looking for? Browse other questions tagged .