Laravel Error 4.2 - SQLSTATE[HY000] [2054] Server charset Unknown to the client. Please, report to the Developers

Asked

Viewed 876 times

-2

I’m having problems in a web application using Laravel 4.2 the same worked in a Windows 7 environment with IIS + PHP 5.6 but I had to change the machine and create a new development environment.

Then I set up a new environment with the following configuration: Windows 10 Home, with IIS 10, PHP 5.6.40 and Mysql Community Server 8.0.19, the application works well until trying to Login/Create Users, when communication occurs with the database, at that point returns an error with the following message:

SQLSTATE[HY000] [2054] Server sent charset Unknown to the client. Please, report to the Developers

inserir a descrição da imagem aqui

In internet searches I found some places saying that this is a bug in the Mysql authentication method, I tried to create a new user to access the base with a different access method, but keeps returning the same error.

Someone has already been through this problem and has some suggestion for solution?

Database access configuration database php.:

<?php

return [

    'fetch' => PDO::FETCH_CLASS,

    /*Default Connections*/
    'default' => 'mysql',

    /*Config Connections*/
    'connections' => [

        'mysql' => [
            'driver'    => 'mysql',
            'host'      => 'localhost',
            'database'  => 'proj',
            'username'  => 'root',
            'password'  => '123456',
            'charset'   => 'utf8',
            'collation' => 'utf8_unicode_ci',
            'prefix'    => '',
        ],

        'sqlsrv' => [
            'driver'   => 'sqlsrv',
            'host'     => '192.168.10.19',
            'database' => 'CEPs',
            'username' => 'root',
            'password' => '1597xxx',
            'prefix'   => '',
        ],

    ],

    /*Config Migrations Path*/
    'migrations' => 'migrations',

    'redis' => [

        'cluster' => false,

        'default' => [
            'host'     => '127.0.0.1',
            'port'     => 6379,
            'database' => 0,
        ],

    ],

];

Error log Laravel.log:

[2020-06-25 18:32:05] production.ERROR: exception 'ErrorException' with message 'PDO::__construct(): Server sent charset (255) unknown to the client. Please, report to the developers' in C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:47
Stack trace:
#0 [internal function]: Illuminate\Exception\Handler->handleError(2, 'PDO::__construc...', 'C:\\PROJETOS\\pro...', 47, Array)
#1 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php(47): PDO->__construct('mysql:host=loca...', 'projetoX', 'veridian12345678', Array)
#2 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\MySqlConnector.php(20): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca...', Array, Array)
#3 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php(57): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#4 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php(46): Illuminate\Database\Connectors\ConnectionFactory->createSingleConnection(Array)
#5 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(176): Illuminate\Database\Connectors\ConnectionFactory->make(Array, 'mysql')
#6 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(64): Illuminate\Database\DatabaseManager->makeConnection('mysql')
#7 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(2922): Illuminate\Database\DatabaseManager->connection('mysql')
#8 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(2888): Illuminate\Database\Eloquent\Model::resolveConnection('mysql')
#9 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1849): Illuminate\Database\Eloquent\Model->getConnection()
#10 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1790): Illuminate\Database\Eloquent\Model->newBaseQueryBuilder()
#11 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1764): Illuminate\Database\Eloquent\Model->newQueryWithoutScopes()
#12 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Auth\EloquentUserProvider.php(87): Illuminate\Database\Eloquent\Model->newQuery()
#13 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Auth\Guard.php(354): Illuminate\Auth\EloquentUserProvider->retrieveByCredentials(Array)
#14 [internal function]: Illuminate\Auth\Guard->attempt(Array, false)
#15 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Support\Manager.php(138): call_user_func_array(Array, Array)
#16 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(211): Illuminate\Support\Manager->__call('attempt', Array)
#17 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(211): Illuminate\Auth\AuthManager->attempt(Array, false)
#18 C:\PROJETOS\projetoX\app\controllers\LoginController.php(35): Illuminate\Support\Facades\Facade::__callStatic('attempt', Array)
#19 C:\PROJETOS\projetoX\app\controllers\LoginController.php(35): Illuminate\Support\Facades\Auth::attempt(Array, false)
#20 [internal function]: LoginController->efetuarLogin()
#21 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(231): call_user_func_array(Array, Array)
#22 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('efetuarLogin', Array)
#23 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(LoginController), Object(Illuminate\Routing\Route), 'efetuarLogin')
#24 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Router.php(967): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'LoginController', 'efetuarLogin')
#25 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#26 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Route.php(109): call_user_func_array(Object(Closure), Array)
#27 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#28 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#29 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(781): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#30 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#31 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Session\Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#32 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Cookie\Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#33 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Cookie\Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#34 C:\PROJETOS\projetoX\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#35 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#36 C:\PROJETOS\projetoX\public\index.php(49): Illuminate\Foundation\Application->run()
#37 {main}

Next exception 'PDOException' with message 'SQLSTATE[HY000] [2054] Server sent charset unknown to the client. Please, report to the developers' in C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php:47
Stack trace:
#0 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\Connector.php(0): PDO->__construct()
#1 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\MySqlConnector.php(20): Illuminate\Database\Connectors\Connector->createConnection('mysql:host=loca...', Array, Array)
#2 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php(57): Illuminate\Database\Connectors\MySqlConnector->connect(Array)
#3 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Connectors\ConnectionFactory.php(46): Illuminate\Database\Connectors\ConnectionFactory->createSingleConnection(Array)
#4 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(176): Illuminate\Database\Connectors\ConnectionFactory->make(Array, 'mysql')
#5 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\DatabaseManager.php(64): Illuminate\Database\DatabaseManager->makeConnection('mysql')
#6 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(2922): Illuminate\Database\DatabaseManager->connection('mysql')
#7 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(2888): Illuminate\Database\Eloquent\Model::resolveConnection('mysql')
#8 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1849): Illuminate\Database\Eloquent\Model->getConnection()
#9 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1790): Illuminate\Database\Eloquent\Model->newBaseQueryBuilder()
#10 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Database\Eloquent\Model.php(1764): Illuminate\Database\Eloquent\Model->newQueryWithoutScopes()
#11 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Auth\EloquentUserProvider.php(87): Illuminate\Database\Eloquent\Model->newQuery()
#12 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Auth\Guard.php(354): Illuminate\Auth\EloquentUserProvider->retrieveByCredentials(Array)
#13 [internal function]: Illuminate\Auth\Guard->attempt(Array, false)
#14 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Support\Manager.php(138): call_user_func_array(Array, Array)
#15 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(211): Illuminate\Support\Manager->__call('attempt', Array)
#16 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Support\Facades\Facade.php(211): Illuminate\Auth\AuthManager->attempt(Array, false)
#17 C:\PROJETOS\projetoX\app\controllers\LoginController.php(35): Illuminate\Support\Facades\Facade::__callStatic('attempt', Array)
#18 C:\PROJETOS\projetoX\app\controllers\LoginController.php(35): Illuminate\Support\Facades\Auth::attempt(Array, false)
#19 [internal function]: LoginController->efetuarLogin()
#20 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Controller.php(231): call_user_func_array(Array, Array)
#21 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(93): Illuminate\Routing\Controller->callAction('efetuarLogin', Array)
#22 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\ControllerDispatcher.php(62): Illuminate\Routing\ControllerDispatcher->call(Object(LoginController), Object(Illuminate\Routing\Route), 'efetuarLogin')
#23 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Router.php(967): Illuminate\Routing\ControllerDispatcher->dispatch(Object(Illuminate\Routing\Route), Object(Illuminate\Http\Request), 'LoginController', 'efetuarLogin')
#24 [internal function]: Illuminate\Routing\Router->Illuminate\Routing\{closure}()
#25 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Route.php(109): call_user_func_array(Object(Closure), Array)
#26 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Router.php(1033): Illuminate\Routing\Route->run(Object(Illuminate\Http\Request))
#27 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Routing\Router.php(1001): Illuminate\Routing\Router->dispatchToRoute(Object(Illuminate\Http\Request))
#28 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(781): Illuminate\Routing\Router->dispatch(Object(Illuminate\Http\Request))
#29 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(745): Illuminate\Foundation\Application->dispatch(Object(Illuminate\Http\Request))
#30 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Session\Middleware.php(72): Illuminate\Foundation\Application->handle(Object(Illuminate\Http\Request), 1, true)
#31 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Cookie\Queue.php(47): Illuminate\Session\Middleware->handle(Object(Illuminate\Http\Request), 1, true)
#32 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Cookie\Guard.php(51): Illuminate\Cookie\Queue->handle(Object(Illuminate\Http\Request), 1, true)
#33 C:\PROJETOS\projetoX\vendor\stack\builder\src\Stack\StackedHttpKernel.php(23): Illuminate\Cookie\Guard->handle(Object(Illuminate\Http\Request), 1, true)
#34 C:\PROJETOS\projetoX\vendor\laravel\framework\src\Illuminate\Foundation\Application.php(641): Stack\StackedHttpKernel->handle(Object(Illuminate\Http\Request))
#35 C:\PROJETOS\projetoX\public\index.php(49): Illuminate\Foundation\Application->run()
#36 {main} [] []
  • show your connection mechanism as database.

1 answer

0


The new Mysql version has changed a standard character set to utf8mb4. Some clients do not recognize this character set. Therefore, when the server reports its default character set to the client and it does not know what the server means it generates the error that occurred to you.

Change the character set to utf8 to be compatible with not updated clients. Maybe the following link will help you...

https://stackoverflow.com/questions/3513773/change-mysql-default-character-set-to-utf-8-in-my-cnf

  • 1

    Really the problem is due to change in the default character set in Mysql 8, I have located the configuration file my ini. in "C: Programdata Mysql Mysql Server 8.0" and set the settings as follows: default-Character-set=utf8 and Character-set-server=utf8 which solved my problem. Thanks for your help.

  • You’re welcome Lenadro, success!

Browser other questions tagged

You are not signed in. Login or sign up in order to post.