PHP :: Bug #74461 :: mysqlnd error on utf8mb4 charset used by MySQL 8.0
php.net |  support |  documentation |  report a bug |  advanced search |  search howto |  statistics |  random bug |  login
Bug #74461 mysqlnd error on utf8mb4 charset used by MySQL 8.0
Submitted: 2017-04-17 16:19 UTC Modified: 2018-05-02 18:15 UTC
Votes:12
Avg. Score:4.5 ± 0.8
Reproduced:11 of 12 (91.7%)
Same Version:6 (54.5%)
Same OS:5 (45.5%)
From: bill at karwin dot com Assigned: johannes (profile)
Status: Closed Package: MySQLi related
PHP Version: 7.1.4 OS:
Private report: No CVE-ID: None
 [2017-04-17 16:19 UTC] bill at karwin dot com
Description:
------------
PHP 7.1 fails to connect to MySQL 8.0.x because of charset incompatibility with MySQL 8.0's new default server charset of utf8mb4.

The workaround is to change the server charset back to pre-MySQL 8.0 default of utf8.

Test script:
---------------
$mysqli = new mysqli('127.0.0.1', 'root', 'xxxx', 'test');

$pdo = new PDO('mysql:host=127.0.0.1;dbname=test', 'root', 'xxxx');


Expected result:
----------------
There should be no error.

Actual result:
--------------
Error when using mysqli:

PHP Warning:  mysqli::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers in ... on line 3

Error when using PDO_MYSQL:

Connection failed: SQLSTATE[HY000] [2054] Server sent charset unknown to the client. Please, report to the developers

Patches

Add a Patch

Pull Requests

Add a Pull Request

History

AllCommentsChangesGit/SVN commitsRelated reports
 [2017-04-17 16:23 UTC] bill at karwin dot com
See also:

https://bugs.mysql.com/bug.php?id=85946

https://github.com/rails/rails/issues/28730
 [2018-05-02 12:13 UTC] requinix@php.net
-Status: Open +Status: Feedback
 [2018-05-02 12:13 UTC] requinix@php.net
Should be fixed as of 7.0.19, 7.1.5, and 7.2.0. Anyone confirm?
 [2018-05-02 17:37 UTC] macleo at outlook dot com
Should be fixed as of 7.0.19, 7.1.5, and 7.2.0. Anyone confirm? - yes
 [2018-05-02 18:15 UTC] requinix@php.net
-Status: Feedback +Status: Closed -Assigned To: +Assigned To: johannes
 
PHP Copyright © 2001-2018 The PHP Group
All rights reserved.
Last updated: Fri Aug 17 16:01:26 2018 UTC