DEV Community

John Smith
John Smith

Posted on • Originally published at on

MySQL server has gone away

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.


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
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 🎉

Top comments (0)