Unable to connect to MySQL

Thanks in advance!
Is there any one to help me past one weak i am trying continually but the answer is

Warning: mysql_connect() [function.mysql-connect]: Access denied for user ‘xxxxxxxxx_xxx’@‘xxx.xxx.xx.xxx’ (using password: YES) in /home/xxxxxxx/public_html/xxxxxxxxxxxx/submit-dsc.php on line 9
Unable to connect to MySQL

but with this same code i could connect in localhost only i will have to change $server option
on my cpanel i twice a time i dropped and rebuild the database with the same user name password which i am using in local

the code which i am using

<?php
if(count($_POST) > 0)
{
// code for database connection string
$username = “xxxxxxxx_xxxx”;
$password = “xxxxxxxxxxxxxx”;
$server = “xxxxxxxxxxxxxxxx.xxx”;

$dbh=mysql_connect($server,$username,$password)
or die(“Unable to connect to MySQL”);
$selected = mysql_select_db(“xxxxxxxxxxx”,$dbh)
or die(“Could not select xxxxxxxxxxx”);

Are you sure, you have password for the user for MySQL on server?
There are some time prefixes used like host123_dbname.
Also some time not all server support localhost in host variable. You need to ask your host company for that.

yes i have the password for the user for MySQL on server
Means what you talking about on server C Panel/MySQL Databases right

Dear mmarif4u
Thanks for you cooperation i have solved the problem!
The problem was i did not allow my external web servers to access my MySQL databases
thanks once again,
Dennis.