<p>Help!</p>

<p>I have a PHP (PHP 5.2.5) script on HOST1 trying to connect to an MySql database HOST2. Both hosts are in Shared Host environments controlled through CPanel.</p>

<p>HOST2 is set to allow remote database connections from HOST1.</p>

<p>The PHP connect I'm using is:-
    $h2 = IPADDRESS;
    $dbu = DBUSER;
    $dbp = DBPASS;</p>

<pre><code>$DBlink = mysql_connect($h2, $dbu, $dbp);
</code></pre>

<p>This always fails with:-</p>

<pre><code>Access denied for user '&lt;dbusername&gt;'@'***SOMESTRING***' (using password: YES)
</code></pre>

<p>nb: <strong><em>SOMESTRING</em></strong> looks like it could be something to do with the shared host environment.</p>

<p>Any ideas???</p>

<p>BTW: I can make remote connections to HOST2 from my laptop using OpenOffice via ODBC, and SQLyog. The SQLyog and ODBC settings are exactly the same as the PHP script is trying to use.</p>

Just some ideas:
HOST1 does not have remote access to HOST2 (shared host is disallowing)
MySQL account does not have access from HOST1 (IP address specified on account creation, or wildcard)
Edit:
In response to your comment, I meant that HOST1 cannot get to the MySQL port on HOST2. Web services will work, of course, because port 80 is open to the public. As another user pointed out though, you are getting a response, so you are reaching it. I would try specifying the DB, and double checking the account creation command you ran.
For the second piece, I meant this:
http://dev.mysql.com/doc/refman/5.0/en/adding-users.html
You can specify what host the username can connect from. If it isn't set to HOST2's IP or the wildcard, HOST2 can't log in with those credentials.