SQLSTATE [HY000]:一般错误:1835 LARAVEL 上的通信数据包格式错误

2022-01-15 00:00:00 mariadb mysql laravel mariadb-10.3

突然得到

SQLSTATE[HY000]: General error: 1835 Malformed communication packet (SQL: select * from tb_users where (username = 121211) limit 1)

SQLSTATE[HY000]: General error: 1835 Malformed communication packet (SQL: select * from tb_users where (username = 121211) limit 1)

在 Laravel 上.

on Laravel.

我已经检查过了:MySQL: ERROR 2027 (HY000): Malformed packet,但情况似乎不同.

I already checked this: MySQL: ERROR 2027 (HY000): Malformed packet, but it seems a different case.

  1. 我之前使用 SSH 登录后成功登录 MySQL(使用:mysql -u -p).
  2. 我已成功从远程 PC 直接登录 MySQL(使用:mysql -h [IP] -u -p).

但是我的 Laravel 遇到了我之前提到的错误.有这方面的经验吗?

But my Laravel got the error I mentioned before. Any experience in this?

推荐答案

我所有运行 PHP 7.2 的 Laravel 应用程序都有这个错误,但运行 PHP 7.3 的应用程序没有.于是我把PHP版本改成了7.3,问题就解决了.(运行 Laravel 7)

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)

相关文章