Are UserID and password correct ?
And dows that user have the privilege to access that database ?
Can you connect with php-based tools (i.e. phpmyadmin)
If all that seems to be OK, then answer please this:
Where is it at ? (ISP/webhotel or a server totally under your own control)
MySQL , php and sqlyog version ? (I suppose that php is up and running correctly on the host ?)