如何使用pdo处理fatcow服务器上的数据库密码?

Well, I'd like to understand why when I set a password to the database, all connections are lost. For example, if I set the password to 123, I can't have access to database and an error message is shown, kind of like:

Error: SQLSTATE[HY000] [1045] Access denied for user 'root'@'10.1.112.103' (using password: NO)

Of course, whenever I change a password for accessing phpmyadmin embedded on Fatcow server, I also want to make sure I changed this info in the config.php too.

When I set no password (password = "";), all connections work normally.

This works:

config.php

<?php
try {
    $pdo = new PDO('mysql:host=localhost;dbname=database','root','');
    $pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);

} catch(PDOException $e) {
    echo 'Error: '.$e->getMessage();
}
?>

Now, this does NOT work:

config.php

<?php
try {
    $pdo = new PDO('mysql:host=localhost;dbname=database','root','123');
    $pdo->setAttribute(PDO::ATTR_ERRMODE,PDO::ERRMODE_EXCEPTION);

} catch(PDOException $e) {
    echo 'Error: '.$e->getMessage();
}
?>

Having in mind that I'm using PDO (I'm not using MySQLi), my PHP version is 5.5.32 and the server is of Fatcow, why is this happening and how to solve this little problem so that I can use a password to protect my database? In my php.ini file, mysql.default_password =. I don't know if the problem is there or in the .htaccess Editor.