• <i id='spIS7'><tr id='spIS7'><dt id='spIS7'><q id='spIS7'><span id='spIS7'><b id='spIS7'><form id='spIS7'><ins id='spIS7'></ins><ul id='spIS7'></ul><sub id='spIS7'></sub></form><legend id='spIS7'></legend><bdo id='spIS7'><pre id='spIS7'><center id='spIS7'></center></pre></bdo></b><th id='spIS7'></th></span></q></dt></tr></i><div id='spIS7'><tfoot id='spIS7'></tfoot><dl id='spIS7'><fieldset id='spIS7'></fieldset></dl></div>

        <bdo id='spIS7'></bdo><ul id='spIS7'></ul>
      <tfoot id='spIS7'></tfoot>

      1. <small id='spIS7'></small><noframes id='spIS7'>

      2. <legend id='spIS7'><style id='spIS7'><dir id='spIS7'><q id='spIS7'></q></dir></style></legend>

      3. “服务器发送客户端未知的字符集(255)"将 M

        时间:2023-10-05

          1. <small id='KfHAl'></small><noframes id='KfHAl'>

          2. <i id='KfHAl'><tr id='KfHAl'><dt id='KfHAl'><q id='KfHAl'><span id='KfHAl'><b id='KfHAl'><form id='KfHAl'><ins id='KfHAl'></ins><ul id='KfHAl'></ul><sub id='KfHAl'></sub></form><legend id='KfHAl'></legend><bdo id='KfHAl'><pre id='KfHAl'><center id='KfHAl'></center></pre></bdo></b><th id='KfHAl'></th></span></q></dt></tr></i><div id='KfHAl'><tfoot id='KfHAl'></tfoot><dl id='KfHAl'><fieldset id='KfHAl'></fieldset></dl></div>
            <legend id='KfHAl'><style id='KfHAl'><dir id='KfHAl'><q id='KfHAl'></q></dir></style></legend>
              <tbody id='KfHAl'></tbody>
                <bdo id='KfHAl'></bdo><ul id='KfHAl'></ul>
                <tfoot id='KfHAl'></tfoot>

                  本文介绍了“服务器发送客户端未知的字符集(255)"将 MySQL 字符集设置为 utf8 w/o/etc/my.cnf?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

                  问题描述

                  我正在尝试从 phpMyAdmin 连接到 MySQL 数据库.但是当我输入用户名和密码时,我收到两条错误消息:

                  I'm trying to connect to a MySQL database from phpMyAdmin. But when I put in username and password I get two error messages saying:

                  mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
                  
                  mysqli_real_connect(): (HY000/2054): Server sent charset unknown to the client. Please, report to the developers
                  

                  我使用的是 MySQL 8.0.11 和 phpMyAdmin 4.8.2

                  I'm using MySQL 8.0.11 and phpMyAdmin 4.8.2

                  我找到了一个类似问题的答案:PDO::__construct():服务器发送客户端未知的字符集 (255).请向开发者报告

                  I found this answer for a similar problem: PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers

                  这里是重要的部分:MySQL 8 将默认字符集更改为 utfmb4.但有些客户端不知道这个字符集.因此当服务器向客户端报告其默认字符集时,客户端不知道是什么服务器的意思是,它抛出这个错误."

                  Here is the important part: "MySQL 8 changed the default charset to utfmb4. But some clients don't know this charset. 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."

                  给出的解决方案是通过在/etc/my.cnf中添加几行并重新启动mysqld将默认字符集改回utf8.

                  The solution given is to change the default charset back to utf8 by adding a few lines to /etc/my.cnf and restart mysqld.

                  我的问题是/etc/my.cnf 在我的文件中不存在任何地方,所以我无法更改那里的默认字符集.我看过的所有其他地方最终都引用了/my.cnf 或引用了旧版本.

                  My problem is that /etc/my.cnf doesn't exist anywhere in my files so I can't change the default charset there. All of the other places I've looked end up referring to /my.cnf or reference older versions.

                  那么,对于 MySQL 8,如何在没有/etc/my.cnf 的情况下将默认字符集更改为 utf8?

                  So, how do I change the default charset to utf8 without a /etc/my.cnf for MySQL 8?

                  推荐答案

                  澄清答案:

                  1. 在您的 /etc/ 文件夹中创建一个名为 my.cnf 的文件.

                  1. Create a file called my.cnf in your /etc/ folder.

                  现在将以下文本添加到/etc/my.cnf:

                  Now add the following text to /etc/my.cnf:

                  [客户]
                  默认字符集=utf8

                  [client]
                  default-character-set=utf8

                  [mysql]
                  默认字符集=utf8

                  [mysql]
                  default-character-set=utf8

                  [mysqld]
                  整理服务器 = utf8_unicode_ci
                  字符集服务器 = utf8
                  default_authentication_plugin = mysql_native_password

                  [mysqld]
                  collation-server = utf8_unicode_ci
                  character-set-server = utf8
                  default_authentication_plugin = mysql_native_password

                  最后重启mysql,一切正常!如果仍有问题,请尝试将 PHP 升级到更高版本.

                  Finally, restart mysql and all should be well! If you still have an issue, try upgrading PHP to a later version.

                  这篇关于“服务器发送客户端未知的字符集(255)"将 MySQL 字符集设置为 utf8 w/o/etc/my.cnf?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持html5模板网!

                  上一篇:是否有必要关闭 PDO 连接 下一篇:插入值列表与列列表不匹配:1136 列计数与值计数

                  相关文章

                  最新文章

                    <i id='VTrIB'><tr id='VTrIB'><dt id='VTrIB'><q id='VTrIB'><span id='VTrIB'><b id='VTrIB'><form id='VTrIB'><ins id='VTrIB'></ins><ul id='VTrIB'></ul><sub id='VTrIB'></sub></form><legend id='VTrIB'></legend><bdo id='VTrIB'><pre id='VTrIB'><center id='VTrIB'></center></pre></bdo></b><th id='VTrIB'></th></span></q></dt></tr></i><div id='VTrIB'><tfoot id='VTrIB'></tfoot><dl id='VTrIB'><fieldset id='VTrIB'></fieldset></dl></div>
                      <bdo id='VTrIB'></bdo><ul id='VTrIB'></ul>

                    <tfoot id='VTrIB'></tfoot>
                      <legend id='VTrIB'><style id='VTrIB'><dir id='VTrIB'><q id='VTrIB'></q></dir></style></legend>

                      <small id='VTrIB'></small><noframes id='VTrIB'>