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

orest's avatar
Level 13

SQLSTATE[HY000] [2006] MySQL server has gone away

I'm running MySQL with DBngin and i get this error. It seems that laravel can't even connect to the database.

SQLSTATE[HY000] [2006] MySQL server has gone away

I saw that increasing the 'max_allowed_packet` the issue can be solved but i haven't found a way to do that in my case.

i downloaded mysql-client and after i connected to my database, i tried to set the max_allowed_packet

set global max_allowed_packet=16000000;

But for some reason it doesn't change, I checked that with

SHOW VARIABLES LIKE 'max_allowed_packet';

This can also be changed in the my.cnf file but because i am running MySQL with DBngin i couldn't find the configuration file. I know that i can set a custom configuration file in DBngin but i'm not sure what else i should include in that file besides the max_allowed_packet in order to make it work.

Any ideas ?

0 likes
2 replies
bobbybouwmann's avatar

You need to restart the MySQL server if you change such a setting.

You typically get "MySQL server has gone away" whenever you're trying to connect to the incorrect host. You need to tell us a bit more about your setup to help you further

orest's avatar
Level 13

Im not sure what information might be useful.

Im using DBngin locally on macOS. Im running MySQL 5.7 through DBngin

I can connect from table plus to the MySQL server at 127.0.0.1 and port 3306.

The .env file has the correct variables.

I just tried to install MySQL with brew and it works. So it seems the issue occurs only when I run MySQL through DBngin

Please or to participate in this conversation.