Skip to content
Advertisement

Failed to connect to MySQL: Server sent charset unknown to the client. Please, report to the developers – SamplePage.php

For some reason, I can’t create the employeeTable on the sample database when opening the SamplePage.php on my Chrome browser from the following link:

http://ec2-13-57-28-240.us-west-1.compute.amazonaws.com/SamplePage.php

I was able to create my EC2 Instance from the AWS Create an EC2 Instance and Install a Web Server tutorial on the following link:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/CHAP_Tutorials.WebServerDB.CreateWebServer.html

I get the following error:

Failed to connect to MySQL: Server sent charset unknown to the client. Please, report to the developers.

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/ |

I also set my Putty /.bash_profile to use the UTF-8 character set, by inputting the configuration as:

export LC_CTYPE="en_US.UTF-8"

Not sure what is going on as I as, I believe, I followed the complete tutorial on how to create a DB Instance and link to EC2 Instance from this link:

https://docs.aws.amazon.com/AmazonRDS/latest/UserGuide/TUT_WebAppWithRDS.html

Advertisement

Answer

Turns out all this work on changing the charset and making sure the charset in the database was set properly was just a dependency on another problem, which was the mysqli extension was not properly installed and enabled. I also upgrade the php version to 7.2, which also may have fixed the issue but I am not entirely sure. Maybe someone can verify what the fix was based on what I had done?

User contributions licensed under: CC BY-SA
8 People found this is helpful
Advertisement