The most common reason for the MySQL server has gone away error is that the query timed out and the connection is closed. This can happen when a MySQL query times out (i.e. a slow query).
We’d recommend running a MySQL check/optimization through phpMyAdmin to try and help with this error, to do this:
1. Sign in to the database you wish to optimise via phpMyAdmin.
2. Select the database from the left-hand side menu.
3. Select the tables you wish to optimise or select ‘Check all’.
4. From the ‘With selected:’ dropdown menu, select ‘Optimize table’.
The ‘OPTIMIZE TABLE’ query that’s run reorganizes the physical storage of table data and associated index data, to reduce storage space and improve I/O efficiency when accessing the table.