MySQL Forums
Forum List  »  PHP

Re: Error 2054 Server sent charset unknown to the client.
Posted by: Mark Hwang
Date: July 20, 2020 10:19AM

I am getting the same error from PDO. MySQL server returns "utf8" from SHOW VARIABLES LIKE 'character_set_system'. My code is as follows:

try {
$user = "test";
$pass = "test";
$options = array(

$dbh = new PDO('mysql:host=localhost;dbname=vrg', $user, $pass, $options);
foreach($dbh->query('SELECT * from FOO') as $row) {
$dbh = null;
catch (PDOException $e) {
print "Error!: " . $e->getMessage() . "<br/>";

Options: ReplyQuote

Sorry, only registered users may post in this forum.

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.