Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

Kris01's avatar

Laravel SQL error

I am dispatching a pretty heavy job, which is meant to store 12 month data that I am taking from stripe. and everytime I try I get this error

SQLSTATE[HY000]: General error: 2006 MySQL server has gone away

What's this and how could I solve it?

0 likes
2 replies
notwonderful's avatar

The most common problem is a connection timeout, causing the server to close it. The solution is very trivial - increasing the wait_timeout in the configuration file.

it could also be related to memory

P.S. don't forget to restart the database after making changes

Snapey's avatar

Sounds like mysql ran out of memory. Check that you have a swapfile setup if you are running on a small VPS, and consider chunking the inserts.

1 like

Please or to participate in this conversation.