Home >Backend Development >PHP Tutorial >Why Does My Symfony 3 App Get a 'PDO::__construct(): Server sent charset (255) unknown to the client' Error When Connecting to MySQL 8.0.1?
Unknown Server Charset Error in PDO MySQL Connection
When attempting to establish a MySQL database connection from a Symfony 3 application, an error message arises: "PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers." This signifies an issue where the MySQL server is transmitting a character set (255) that the PHP client is unfamiliar with.
Background:
The error stems from MySQL 8.0.1's default character set transformation to utf8mb4. However, not all clients may recognize this new character set. As a result, the server's transmission triggers this error.
Solution:
The optimal solution is to upgrade the client software. However, an interim workaround is available:
[client] default-character-set=utf8 [mysql] default-character-set=utf8 [mysqld] collation-server = utf8_unicode_ci character-set-server = utf8
Additional Considerations:
The above is the detailed content of Why Does My Symfony 3 App Get a 'PDO::__construct(): Server sent charset (255) unknown to the client' Error When Connecting to MySQL 8.0.1?. For more information, please follow other related articles on the PHP Chinese website!