Search code examples
phplaravelauthenticationsystemmigrate

SQLSTATE[HY000] [2054] Server sent charset unknown to the client. Please, report to the developers


I am trying to create a login system in laravel. I've updated env. file with a database called kokodb. However, when I run this code 'php artisan migrate' in cmd, I came up with the following error:

In Connection.php line 647:

SQLSTATE[HY000] [2054] Server sent charset unknown to t he client. Please, report to the developers (SQL: selec t * from information_schema.tables where table_schema = kokodb and table_name = migrations)

In Connector.php line 68:

SQLSTATE[HY000] [2054] Server sent charset unknown to t he client. Please, report to the developers

In Connector.php line 68:

PDO::__construct(): Server sent charset (255) unknown t o the client. Please, report to the developers

Can you please help me. I did not find any solution to this problem anywhere else.


Solution

  • What version of PHP are you using?

    According to PHP's bugtracker, this should be fixed as of 7.0.19, 7.1.5, and 7.2.0.

    https://bugs.php.net/bug.php?id=74461

    Some answers recommended changing the server charset back to utf8 from utf8mb4, but that is a bad idea. utf8 doesn't support the full range of valid unicode characters, so trying to save a string that contains certain characters (like some sets of emoji) will cause a database error. It is much better to simply upgrade PHP to a more recent version.