![](/img/trans.png)
[英]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.