Manuals are your friends:
19.2.1 MySQL server has gone away error
<snip snip>
You can also get these errors if you send a query to the server that is incorrect or too large. If mysqld gets a packet that is too large or out of order, it assumes that
something has gone wrong with the client and closes the connection. If you need big queries (for example, if you are working with big BLOB columns), you can
increase the query limit by starting mysqld with the -O max_allowed_packet=# option (default 1M). The extra memory is allocated on demand, so mysqld will
use more memory only when you issue a big query or when mysqld must return a big result row!