PHP message: PHP Warning: PDO::__construct(): Server sent charset (255) unkno wn to the client. Please, report to the developers code example

Example 1: mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers

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

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

    [client]
    default-character-set=utf8

    [mysql]
    default-character-set=utf8

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

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

Example 2: mysqli_real_connect(): Server sent charset (255) unknown to the client. Please, report to the developers

Editaremos el archivo de configuración my.cnf
El cual se debe encontrar en C:\ProgramData\MySQL\MySQL Server 8.0
Agregamos y/o modificamos las siguientes lineas:

[client]
default-character-set=utf8

[mysql]
default-character-set=utf8

[mysqld]
collation-server = utf8_unicode_ci

character-set-server = utf8 

Una vez hecho esto, reinicien su servicio de Mysql

Tags:

Sql Example