This trick will work for all versions of WordPress. Open your Wordpress directory. The directory will contain folders:
wp-admin wp-content wp-includes
Open wp-includes. Locate the wp-db.php file. If you find the file, open it with a text editor. Using the text editor search tool, search for:
$this->ready = true;
After you find the line, add the following lines immediately after the found line:
//WP Query Gone Away Error Fix $this->query("set session wait_timeout=600");
You can also follow https://subinsb.com/fix-wordpress-error-mysql-server-has-gone-away for viewing in more detailed posts.
source share