[英]Sphinx:Server sent charset unknown to the client. Please, report to the developers
[英]Failed to connect to MySQL: Server sent charset unknown to the client. Please, report to the developers - SamplePage.php
由于某种原因,在我的 Chrome 浏览器上通过以下链接打开SamplePage.php
时,我无法在sample
数据库上创建employeeTable
:
http://ec2-13-57-28-240.us-west-1.compute.amazonaws.com/SamplePage.php
我能够从 AWS 创建 EC2 实例并在以下链接上安装 Web 服务器教程:
我收到以下错误:
无法连接到 MySQL:服务器向客户端发送未知字符集。 请向开发人员报告。
From what I read, the AWS Linux AMI image has a UTF-8 character set by default and I get the output running this command on my EC2 Instance after connecting to my MySQL DB Instance:
SHOW VARIABLES LIKE 'char%';
Variable_name | Value
|+--------------------------+-------------------------------------------+
| character_set_client | utf8 |
| character_set_connection | utf8 |
| character_set_database | utf8mb4 |
| character_set_filesystem | binary |
| character_set_results | utf8 |
| character_set_server | utf8mb4 |
| character_set_system | utf8 |
| character_sets_dir | /rdsdbbin/mysql-8.0.17.R1/share/charsets/ |
我还将 Putty /.bash_profile
设置为使用 UTF-8 字符集,方法是将配置输入为:
export LC_CTYPE="en_US.UTF-8"
我不知道发生了什么,我相信,我遵循了有关如何创建数据库实例并从此链接链接到 EC2 实例的完整教程:
https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/TUT_WebAppWithRDS.html
事实证明,所有关于更改字符集和确保数据库中的字符集设置正确的工作只是依赖于另一个问题,即mysqli
扩展未正确安装和启用。 我还将 php 版本升级到 7.2,这也可能解决了这个问题,但我不完全确定。 也许有人可以根据我所做的验证修复是什么?
我通过删除 php56 并改为安装 php72 解决了这个问题。 以下是命令
sudo yum -y remove php*
sudo yum install php72
sudo yum install php72-mysqlnd
sudo apachectl restart
这取决于。
您是否还没有将任何文本放入表格中,然后:
ALTER TABLE t CONVERT TO CHARACTER SET utf8mb4;
如果表中有数据,则大约有 3 种不同的方法可以更改字符集。 提示在这里:
http://mysql.rjweb.org/doc.php/charcoll#fixes_for_various_cases
如果出现垃圾,请参阅UTF-8 字符的问题; 我看到的不是我存储的
要解决此问题,请删除 PHP 7.4 并替换为 7.2
sudo yum -y remove php*
sudo amazon-linux-extras disable php7.4
sudo amazon-linux-extras enable php7.2
yum clean metadata
sudo yum install php php-{pear,cgi,common,curl,mbstring,gd,mysqlnd,gettext,bcmath,json,xml,fpm,intl,zip,imap}
php -v
sudo apachectl restart
声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.