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

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
 [2024-05-21 20:20 UTC] stevenwilkins22 at hotmail dot co dot uk
hi, i am using mysqlserver 8.4 the latest version and i am using php 8.0. when i am trying to connect my PHP scripts on notepad++ to mysql server, i am getting this error message which i cant seem to solve




 "Warning: mysqli_connect(): Server sent charset (255) unknown to the client. Please, report to the developers in C:\Abyss Web Server\site_db.php on line 4

Warning: mysqli_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers in C:\Abyss Web Server\site_db.php on line 4
Server sent charset unknown to the client. Please, report to the developers"



im on a windows 10 machine and i am using apprelium web server. i cannot link my php scripts on notepad+ to mysql, can you help me please ?

regards,

steven
 
PHP Copyright © 2001-2024 The PHP Group
All rights reserved.
Last updated: Sat Jun 22 23:01:29 2024 UTC