injetkilo injetkilo - 6 days ago 6
PHP Question

SQLSTATE[28000] [1045] : Strange PDO error after server provider crash

After a crash server, we have a strange error with our database...

Password and user is correct, we use a simple PDO connect :

session_start();
ini_set('display_errors', 1);
ini_set('log_errors', 1);
try
{
$bdd = new PDO('mysql:host=localhost;dbname=databaseName', 'correctUSER','correctPassword');
die('ok');
}
catch(Exception $e)`enter code here`
{
die('Erreur : '.$e->getMessage());
}


But we have a : "Error : SQLSTATE[28000] [1045] Access denied for user 'correctUSER'@'localhost' (using password: YES)" ??

We try to delete, recreate database and user but we have always the problem, the strange thing is that if we try we the root user => it works but it's not safe to use the root password...

Anyone have a solution ??

Thanks !

Answer

It was an error with mysql, I have to make a

REPAIR TABLE mysql.user