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

Hayk_D's avatar

MySQL 5.7 has gone away

Hi!

My MBP MySQL 5.7 (installed via Homebrew) goes away regularly, 10-15 times a day, even after simple selects of not much data. Did anyone have the same issue? Is there any way to solve this?

| max_allowed_packet | 1073741824 |

Thank you all in advance.

0 likes
9 replies
Hayk_D's avatar

Thanks @tomopongrac It is set to 1073741824 by default and I think it is considered as 1 GB as it is suggested here https://prnt.sc/p9q1xu

I didn't find on the web on how to change brew installed MySQL config. Any tips will be appreciated.

tomopongrac's avatar

In terminal type this command to find where is my.cnf file is

mysql --verbose --help | grep my.cnf

Then in my.cnf file add this to change max_allowed_packet

max_allowed_packet = ???

and then you need to restart mysql

Hayk_D's avatar

Thanks @tomopongrac There were many locations, the one that took effect was ~/.my.cnf Thanks!

Hayk_D's avatar

Setting max_allowed_packet to a lower value (500 MB) didn't resolve the issue. So it still persists. Anyone having the same issue?

Sinnbeck's avatar

I belive @tomopongrac suggested that you increse it instead of lowering it. But instead I would suggest you use something like laravel telescope to inspect the queries run. If you are only running smaller queries on a small database, you shouldnt hit 1 GB

Hayk_D's avatar

@resin The issue was suspected to be Packet Too Large if max_allowed_packet is more than 1GB. So lowering the value could resolve it if it was the issue. However, it was not. If MySQL goes away, I am afraid, Telescope could hardly be of any help.

Sinnbeck's avatar

Oh sorry, I misunderstood :) Does your logs reveal anything?

Hayk_D's avatar
Hayk_D
OP
Best Answer
Level 5

I ended up installing MySQL 8 with Homebrew and switching to it. It seems it has resolved the issue. Thanks everyone for input!

Please or to participate in this conversation.