How do I fix the error “Mysql Server has gone away”?

The most logical explaination for this error would be “Server dropped an incorrect or too large packet”. If mysqld gets a packet that is too large or incorrect, it assumes that something has gone wrong with the client and closes the connection. You can increase the limit of the packet size by executing the following command’;

SET GLOBAL max_allowed_packet=1073741824;

Update ‘1073741824’ with any higher value than the current value.
You can check the current packet limit by running the sql
SHOW variables LIKE ‘max_allowed_packet’