MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误
Posted bogiang
tags:
篇首语:本文由小常识网(cha138.com)小编为大家整理,主要介绍了MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误相关的知识,希望对你有一定的参考价值。
报错信息:
php Warning: Packets out of order. Expected 1 received 56. Packet size=3420216 in /data/bogiang/test/EC/swoole_process.php on line 62
Warning: Packets out of order. Expected 1 received 56. Packet size=3420216 in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Warning: PDO::query(): mysql server has gone away in /data/bogiang/test/EC/swoole_process.php on line 62
Warning: PDO::query(): MySQL server has gone away in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Warning: PDO::query(): Error reading result set\'s header in /data/bogiang/test/EC/swoole_process.php on line 62
Warning: PDO::query(): Error reading result set\'s header in /data/bogiang/test/EC/swoole_process.php on line 62
PHP Fatal error: Uncaught Error: Call to a member function fetchAll() on bool in /data/bogiang/test/EC/swoole_process.php:63
Stack trace:
#0 [internal function]: {closure}(Object(Swoole\\Process))
#1 /data/bogiang/test/EC/swoole_process.php(67): Swoole\\Process->start()
#2 {main}
thrown in /data/bogiang/test/EC/swoole_process.php on line 63
Fatal error: Uncaught Error: Call to a member function fetchAll() on bool in /data/bogiang/test/EC/swoole_process.php:63
Stack trace:
#0 [internal function]: {closure}(Object(Swoole\\Process))
#1 /data/bogiang/test/EC/swoole_process.php(67): Swoole\\Process->start()
#2 {main}
thrown in /data/bogiang/test/EC/swoole_process.php on line 63
造成原因:
多进程使用同一个mysql链接导致出来的。
为什么会出现这问题:
1.多进程中MYSQL不可以使用同一个链接
2.如果使用需要一个连接池
网上查看了几篇报错的原因:
Thinkphp5框架使用swoole,数据连接报Packets out of order.
PHP MYSQL Packets out of order. Expected 1 received 0. Packet size=
为什么DB连接管理一般不采用IO多路复用?
解决问题:
1、在每个进程里进行链接mysql
2、使用连接池,避免这个问题
php搭建mysql连接池
以上是关于MYSQL Packets out of order. Expected 1 received 56. Packet size=3420216错误的主要内容,如果未能解决你的问题,请参考以下文章
MySQL报错argument out of range 1055解决办法
mysqld: Out of memory 解决办法(mysql)
MySQL ERROR Got an error reading communication packets
Mysql Query error: BIGINT UNSIGNED value is out of range in..解决方法