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

faizankhan619's avatar

SQLSTATE[HY000] [2006] MySQL server has gone away (Connection: mysql, SQL: delete from cache)

Hello there,

I followed all the steps to deploy laravel project to siteground. Everything seems to be working fine until Create a deployment script step. I'm using php 8.2 hence changing php81 to php82 other then that everything is same. When I run ./build.sh I get following error

I've already created a DB and passed the correct DB name, username and password in .env file. I googled the issue and recommended answer was to increase the max_allowed_packet in my.cnf file. I was able to ssh in my project directory. I found my.conf and tried to increase add this line max_allowed_packet=64M but it is read only.

I also ran set global max_allowed_packet=64*1024*1024;

What else coule be the reason of MySQL server error? In site ground my project directory structure looks like below

image

My build.sh this created by @snapey Complete guide https://laravelsharedhosting.novate.co.uk/

0 likes
1 reply
jlrdw's avatar

Have you checked the max_allowed_packet?

Please or to participate in this conversation.