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
View Add Comment Developer Edit
Anyone can comment on a bug. Have a simpler test case? Does it work for you on a different platform? Let us know!
Just going to say 'Me too!'? Don't clutter the database with that please !
Your email address:
MUST BE VALID
Solve the problem:
31 + 20 = ?
Subscribe to this entry?

 
 [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

bilm (last revision 2020-03-11 15:10 UTC by tarik at hotmail dot com)

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
 [2020-03-11 15:10 UTC] tarik at hotmail dot com
The following patch has been added/updated:

Patch Name: bilm
Revision:   1583939408
URL:        https://bugs.php.net/patch-display.php?bug=74461&patch=bilm&revision=1583939408
 [2023-01-09 13:38 UTC] erenlolbtw97 at gmail dot com
sa
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Thu Apr 25 07:01:31 2024 UTC