Mysql – Remote Server can’t access RDS Database

amazon-rdsamazon-web-servicesMySQLPHPrds

I'm having problems accessing my Amazon RDS MySQL Database from my server.

I get this:-

[Thu Sep 22 13:45:33 2011] [error] [client xx.xx.xx.xx] PHP Warning:  mysqli::mysqli() [<a href='function.mysqli-mysqli'>fqli-mysqli</a>]: (HY000/2003): Can't connect to MySQL server on 'xxxx-1.rds.amazonaws.com' (110) xxx.php on line 22, referer: xxx**

I've tried manually accessing via cmdline on server with:-

mysql -h xxxx.rds.amazonaws.com -p –port=3306

I then asks for password – which I put in, and it hangs and says

ERROR 2003 (HY000): Can't connect to MySQL server on 'xxxx.rds.amazonaws.com' (110)

Is this a port and/or firewall related problem? If so, what should I be addressing?

Is it because I'm already running a mysql srvr on this box, on port 3306?

Best Answer

Possible reasons are - Firewall is blocking access to port 3306 - database server is not running on default port (3306) - the MySQL daemon is configured to accept connections only from localhost, not from remote host. (can be tested by "netstat -ntlp").