SOFTELメモ Developer's blog

[php] Server sent charset unknown to the client.

2024/10/20 MySQL, php ,

問題

phpからMySQLに接続したいのですが、以下のエラーで接続できません。

Server sent charset unknown to the client.
Server sent charset (255) unknown to the client. Please, report to the developers

答え

php5やphp7からMySQL8に接続しようとすると、クライアント側がutf8mb4が分からなくてエラーになる。

サーバー側に対応をお願いする。

デフォルトはutf8とするように設定する。

collation-server = utf8_unicode_ci
character-set-server = utf8

/etc/my.cnf.d/mysql-server.cnf などに追記して、mysqldを再起動する。

関連するメモ

コメント