Re: Error 2054 Server sent charset unknown to the client.
I am getting the same error from PDO. MySQL server returns "utf8" from SHOW VARIABLES LIKE 'character_set_system'. My code is as follows:
<?php
try {
$user = "test";
$pass = "test";
$options = array(
PDO::MYSQL_ATTR_INIT_COMMAND => 'SET NAMES utf8',
);
$dbh = new PDO('mysql:host=localhost;dbname=vrg', $user, $pass, $options);
foreach($dbh->query('SELECT * from FOO') as $row) {
print_r($row);
}
$dbh = null;
}
catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";
die();
}
?>
Subject
Written By
Posted
Re: Error 2054 Server sent charset unknown to the client.
July 20, 2020 10:19AM
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.