server sent charset (255) unknown to the client mysql code example

Example: 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.

Tags:

Sql Example