When I try to connect to my database from PHP I get this error:
Access denied for user 'XXX'@'%' to database 'XXX'
I am using this code to connect:
$con = mysql_connect('XXX.db.XXX.hostedresource.com', 'XXX', 'XXX') or die (mysql_error());
$db = mysql_select_db("DB", $con);
This generally means username/password is not correct.Be sure that hostname from you are trying to connect actually can connect it.This has nothing to do with PHP itself.
If you have root privilege you can check following command: