[英]Database_Exception [ 2 ]: mysqli_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
Installed on the local machine Docker and Kohana framework. 安装在本地计算机Docker和Kohana框架上。
I can't establish a connection to the database. 我无法建立与数据库的连接。
An error occurs: 发生错误:
Database_Exception [ 2 ]: mysqli_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
Filу datebase.php 填写datebase.php
return array
( 'default' => array ( 'type' => 'MySQLi', 'connection' => array( 'hostname' => 'mysql', 'database' => 'media', 'username' => 'root', 'password' => 'root', 'persistent' => FALSE, ), 'table_prefix' => '', 'charset' => 'utf8mb4', 'caching' => FALSE, ('default'=> array('type'=>'MySQLi','connection'=> array('hostname'=>'mysql','database'=>'media','username'=>'root' ,'password'=>'root','persistent'=> FALSE,),'table_prefix'=>'','charset'=>'utf8mb4','caching'=> FALSE,
MySQL has changed the default charset to utfmb4 from version 8. But some clients don't know this charset. MySQL已将默认字符集从版本8更改为utfmb4。但是某些客户端不知道该字符集。 Hence when the server reports its default charset to the client, and the client doesn't know what the server means, it throws this error.
因此,当服务器向客户端报告其默认字符集时,客户端不知道服务器的含义时,它将引发此错误。
See also https://bugs.mysql.com/bug.php?id=71606 另请参见https://bugs.mysql.com/bug.php?id=71606
That bug is against the MySQL Connector/C++ so it's affecting more than just PHP. 该错误是针对MySQL Connector / C ++的,因此它影响的不仅仅是PHP。
Okay - I got it to work by changing the character set to utf8, to be compatible with non-upgraded clients. 好的-通过将字符集更改为utf8,使其与未升级的客户端兼容,我可以使用它。 I added this to /etc/my.cnf and restarted mysqld:
我将此添加到/etc/my.cnf并重新启动mysqld:
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
I found these settings in an answer from 2010: Change MySQL default character set to UTF-8 in my.cnf? 我在2010年的答案中找到了这些设置: 在my.cnf中将MySQL默认字符集更改为UTF-8吗?
You can use mysql:5.7
and php:7.3.9
docker images, this seems to work well. 您可以使用
mysql:5.7
和php:7.3.9
docker镜像,这似乎运行良好。
Got this from here: 从这里得到这个:
https://community.atlassian.com/t5/Bitbucket-questions/Pipelines-Server-sent-charset-unknown-to-the-client/qaq-p/780112 and https://community.atlassian.com/t5/Bitbucket-questions/Pipelines-Server-sent-charset-unknown-to-the-client/qaq-p/780112和
https://bugs.mysql.com/bug.php?id=85946 https://bugs.mysql.com/bug.php?id=85946
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.