I don't know why, but using PDO MYSQL when trying to connect with:
$host='localhost';
$db='contratos';
$user='contratos';
$password='!!contratos';
$link = new \PDO("mysql:host={$host};dbname={$db};charset=utf8", $user, $password);
PDO tries to connect adding an extra @ before host:
PDOException: SQLSTATE[HY000] [1045] Accès refusé pour l'utilisateur: 'contratos'@'@localhost' (mot de passe: OUI) in C:\wamp\www\contratos\classes\mysql.php on line 154
I'm using a external class to handle all mysql queries, but, before it was working properly and none of my code was modified.
Is this a PHP, MYSQL, PDO or what error/bug?
edit: I'm trying to connect, not to create user or grant any rights, I can't connect through PHP, but I'm able to connect using MySQL Workbench