I works on a android application, with a PHP server, linked to MySQL.
In my PHP server, I try to create a PDO.
try{
$pdo = new PDO('mysql:host=localhost;dbname=quiz_android_db','root','****');
}
catch (PDOException $e){
echo ('Erreur: ' . $e->getMessage());
}
But each Time, I have this error :
Erreur: SQLSTATE[HY000] [1045] Access denied for user 'root'@'localhost' (using password: YES)
I use the same username and the same password in a mysqli object and it works. Where could be the problem ?
I use windows 10, php 5.6.19 , mysql 5.17.11
EDIT : This is the way use mysqli
$mysqli = new mysqli("localhost","root","****","quiz_android_db");
if ($mysqli->connect_errno) {
echo "Echec lors de la connexion à MySQL : (" . $mysqli->connect_errno . ") " . $mysqli->connect_error;
return null;
}