I'm using MAMP and MySQL version 8.0.16 and php 7.4.1
Whenever I try to get the data from the database. I keep running into this error
Error!: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
I've granted the user with all the privileges but still i keep running into this error and not sure why
try {
$dbh = new PDO('mysql:host=localhost;dbname=test', $user, $pass);
foreach($dbh->query('SELECT * from testing') as $row) {
print_r($row);
}
$dbh = null;
} catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
Here's the code i'm running but keep running into dead end. Someone please help ! What am I doing wrong ?