网络托管 - 用户'用户名'@'localhost'拒绝访问(使用密码:否)

I'm uploading my website on HostGator, but I have a problem with MySql, i get this error :

Access denied for user 'hostgatoruser'@'localhost' (using password: NO)

And this is my php code :

try
{
    $DB = new PDO('mysql:host=localhost;dbname=hostgatoruser_database', 'hostgatoruser_abc', '********');
}
catch(Exception $e)
{
        die('Erreur : '.$e->getMessage());
}

Why the error tells me Access denied for user "hostgatoruser@localhost" instead of "hostgatoruser_abc" ? How to fix it ?

EDIT: OK, the problem was caused by the mysql_real_escape_string functions, so I removed them. I still dunno why I can't use mysql_real_escape_string...

As well as some of the comments here suggesting you check your username/password, it's also worth checking that the user has got permissions granted for that particular database.

You can find out what permissions you've been given by running:

SHOW GRANTS FOR 'hostgatoruser'@'localhost';