Suddenly got
SQLSTATE[HY000]: General error: 1835 Malformed communication packet (SQL: select * from
tb_userswhere (username= 121211) limit 1)
on Laravel.
I already checked this: MySQL: ERROR 2027 (HY000): Malformed packet, but it seems a different case.
But my Laravel got the error I mentioned before. Any experience in this?
All my Laravel apps running PHP 7.2 had this error but those running on PHP 7.3 did not. So I changed the PHP version to 7.3 and the problem was fixed. (Running Laravel 7)
Found the solution. Don't know if it's permanent or temporary:
'mysql' => [             'driver' => 'mysql',             'host' => env('DB_HOST', '127.0.0.1'),             'port' => env('DB_PORT', '3306'),             'database' => env('DB_DATABASE', 'forge'),             'username' => env('DB_USERNAME', 'forge'),             'password' => env('DB_PASSWORD', ''),             'unix_socket' => env('DB_SOCKET', ''),             'charset' => 'utf8mb4',             'collation' => 'utf8mb4_unicode_ci',             'prefix' => '',             'strict' => false,             'engine' => null,             **'options'   => [PDO::ATTR_EMULATE_PREPARES => true]**         ], make sure that
'options' => [PDO::ATTR_EMULATE_PREPARES => true]
exist on mysql connection.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With