MySQL Forums
Forum List  »  PHP

SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
Posted by: Kennet Hafstedt
Date: June 13, 2019 02:29PM

Hi guys,

This is probably very basic but to me, it has become an obstacle I can't get by, it seems.
---------------------------------------
I'm trying to use:

MySQL -> MySQL Server 8.0
PHP -> PHP72
Server -> Apache24
Browser -> CHROME VERSION 74.0.3729.169
OS -> Windows 10

---------------------------------------

---------------------------------------
The PHP code looks like this:

<?php
if (!defined('PDO::ATTR_DRIVER_NAME')) {
echo 'PDO is unavailable<br/>';
}
elseif (defined('PDO::ATTR_DRIVER_NAME')) {
echo 'PDO is available<br/>';
}
?>

<?php
$servername = "localhost";
$username = "";
$password = "";

try {

$conn = new PDO("mysql:host=$servername;dbname=dekorationshuset", $username, $password);

// set the PDO error mode to exception
$conn->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
echo "Connected successfully";
}
catch(PDOException $e)
{
echo "Has failed: " . $e->getMessage();
}
?>
----------------------------------------

----------------------------------------
What I get out using Chrome looks like this:

PDO is available
Connection failed: SQLSTATE[HY000] [2054] The server requested authentication method unknown to the client
----------------------------------------

This might very well be basic to some of you (hope so), but to me, it's become a threshold I can't get över. Yes, I have searched the net and tried almost everything that makes any sense to me but I'm stuck so please help.

Best to you all
Kennet

Options: ReplyQuote




Sorry, you can't reply to this topic. It has been closed.

Content reproduced on this site is the property of the respective copyright holders. It is not reviewed in advance by Oracle and does not necessarily represent the opinion of Oracle or any other party.