loading...

MySQL server has gone away

solrevdev profile image John Smith Originally published at solrevdev.com on ・1 min read

Another quick one for today.

After a little while developing on and against Windows, I am back developing on the lovely macOS.

I have a local install of MySQL and when I connected to it via my terminal using mysql -u root I would connect ok but as soon as I tried to do anything I would get the following error.

screenshot

ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
ERROR 2013 (HY000): Lost connection to MySQL server at 'reading initial communication packet', system error: 102
ERROR:
Can't connect to the server

This turned out to be an easy fix, one of the first debugging steps was to restart the MySQL service on my machine followed by restarting the MySQL process.

sudo killall mysqld
mysql.server start

I was then able to connect via mysql -uroot!

Success 🎉

Posted on by:

solrevdev profile

John Smith

@solrevdev

full-time carer formally head of infrastructure and operations, senior full-stack #dotnetcore #aspnetcore #vuejs developer and software engineer.

Discussion

pic
Editor guide