I have a database set up on a godaddy server. It is configured to allow remote access, and there are a couple of websites I'm running which need to access this data. It works when accessed from another godaddy site, and I can connect from my development environment both at work and home. We recently set up hosting with mydomain.com.
Here is the code block that triggered it:
$servername = "XX.XX.XXX.XX";
$dbusername = "databaseusername";
$dbpassword = "mahpassword";
$dbname = "databasename";
$newMysql = new PDO("mysql:host=".$servername.";dbname=".$dbname, $dbusername, $dbpassword);
echo 'connection Failed: '. $e->getMessage();
connection Failed: SQLSTATE[HY000]  Can't connect to MySQL server on 'XX.XX.XXX.XX' (111)
(mysql -h XX.XX.XXX.XX ...)
select * from SCHEMA_PRIVILEGES
select * from USER_PRIVILEGES
As it has been more than a year since I asked this question, I suppose I need to answer it just to close it.
It turns out that godaddy had blocked mydomain.com servers via firewall ("Remote access" was limited). so in order to accomplish what I wanted to do, I had to copy and store the database on both sites.