Installed on the local machine Docker and Kohana framework.
I can't establish a connection to the database.
An error occurs:
Database_Exception [ 2 ]: mysqli_connect(): Server sent charset (255) unknown to the client. Please, report to the developers
Filу datebase.php
return array
(
'default' => array
(
'type' => 'MySQLi',
'connection' => array(
'hostname' => 'mysql',
'database' => 'media',
'username' => 'root',
'password' => 'root',
'persistent' => FALSE,
),
'table_prefix' => '',
'charset' => 'utf8mb4',
'caching' => FALSE,
How to solve this problem?
MySQL has changed the default charset to utfmb4 from version 8. But some clients don't know this charset. Hence when the server reports its default charset to the client, and the client doesn't know what the server means, it throws this error.
See also https://bugs.mysql.com/bug.php?id=71606
That bug is against the MySQL Connector/C++ so it's affecting more than just PHP.
Okay - I got it to work by changing the character set to utf8, to be compatible with non-upgraded clients. I added this to /etc/my.cnf and restarted mysqld:
[client]
default-character-set=utf8
[mysql]
default-character-set=utf8
[mysqld]
collation-server = utf8_unicode_ci
character-set-server = utf8
I found these settings in an answer from 2010: Change MySQL default character set to UTF-8 in my.cnf?