简体   繁体   English

Database_Exception [2]:mysqli_connect():服务器向客户端发送了未知的字符集(255)。 请向开发商报告

[英]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,

How to solve this problem? 如何解决这个问题呢? 在此处输入图片说明

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吗?

暂无
暂无

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

相关问题 PDO::__construct():服务器向客户端发送未知字符集 (255)。 请向开发人员报告 - PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers Sphinx:服务器向客户端发送未知的charset。 请向开发人员报告 - Sphinx:Server sent charset unknown to the client. Please, report to the developers 无法连接到 MySQL:服务器向客户端发送未知字符集。 请向开发人员报告 - SamplePage.php - Failed to connect to MySQL: Server sent charset unknown to the client. Please, report to the developers - SamplePage.php SQLSTATE[HY000] [2054] 服务器发送了客户端未知的字符集。 请向开发者报告 - SQLSTATE[HY000] [2054] Server sent charset unknown to the client. Please, report to the developers 错误:警告:mysqli_connect():服务器发送的字符集 (255) 客户端未知 - Error: Warning: mysqli_connect(): Server sent charset (255) unknown to the client mysql_connect():服务器向客户端发送未知字符集(255) - mysql_connect(): Server sent charset (255) unknown to the client mysqli_connect(): (HY000/1049): 未知数据库 - mysqli_connect(): (HY000/1049): Unknown database 警告:mysqli_connect():未知的 MySQL 服务器主机 - Warning: mysqli_connect(): Unknown MySQL server host mysqli_connect 未连接到数据库 - mysqli_connect not connecting to database Kohana-Database_Exception [2]:mysql_connect() - Kohana - Database_Exception [ 2 ]: mysql_connect()
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM