如何在MySQL上的PDO查询期间解决格式错误的数据包错误?

时间:2017-12-20 10:48:36

标签: php mysql pdo

我正在运行带有大数据的select查询以在Mysql上提取 我收到了这个错误

Fatal error: Uncaught PDOException: SQLSTATE[HY000]: General error: 2027 Malformed packet 

这是我检索数据的代码 在Windows上,此查询工作正常但不在Linux上

try{
$db4=new PDO('mysql:host=10.25.32.2;dbname=database','username','password');//connexion mysql
$db4->setAttribute(PDO::ATTR_ERRMODE, PDO::ERRMODE_EXCEPTION);
}catch(PDOException $e){
    echo  $e->getMessage();
}

enter code here
$sql="select dealer activator,msisdn_v msisdn,left(received_date,10) adate,
right(received_date,8)heure,contract_source ACTIVATION_TOOLS
,st status,iccid serial,c.site_id,username from my_table a
left join work.my_table2 b on a.dealer=b.msisdn
left join dm_cb.my_table3 c on c.CGI=b.cgi
where (TYPE_TRANSACT like 'Acquisition SIM Blanche%' or 
TYPE_TRANSACT like  '%Acquisition_SB%')
and left(received_date,10) >='2017-12-18' limit 1000";

$requete=$db4->prepare($sql);
$requete->execute();

$rows=$requete->fetchAll(PDO::FETCH_ASSOC);

0 个答案:

没有答案