0

I am facing this serious issue. My application shows this error often:

<h1>A Database Error Occurred</h1>
    <p>Error Number: 2006</p><p>MySQL server has gone away</p><p>UPDATE `leads` SET `sellerId` = '41', `leadDate` = '2018-02-20'
WHERE `leadId` = '1885'</p><p>Filename: models/LeadsModel.php</p><p>Line Number: 436</p>    </div>

-

 Error while sending QUERY packet. PID=4508

I know that there are many people provided solutions for this issue but nothing worked for me.

Even I changed max_allowed_packet

max_allowed_packet=20528M

But still don't work. Error message is not giving any clue.

Any solution to this?

Thanks in advance

Ayyaz Zafar
  • 2,015
  • 5
  • 26
  • 40
  • I have the same issue, sometime error shows. I found this post: https://stackoverflow.com/questions/6054832/getting-mysql-error-error-code-2006-mysql-server-has-gone-away and also this https://github.com/bcit-ci/CodeIgniter/issues/4957, see second last comment from @eranhazout. I'm still trying to find the reason, let you know case I find something... – Vickel Feb 20 '18 at 18:54

2 Answers2

0

Just a guess here,but in case leadId is numeric try removing the quotes:

UPDATE `leads` SET `sellerId` = '41', `leadDate` = '2018-02-20'
WHERE `leadId` = 1885;

Problem might be that searching for the wrong datatype makes the query very slow.

Mihai
  • 26,325
  • 7
  • 66
  • 81
0

You can also increas the timeout values

ini_set('mysql.connect_timeout', 600);
ini_set('default_socket_timeout', 600); 
guigoz
  • 674
  • 4
  • 21