A fatal MySQL error occured.

Query:
SELECT SQL_CALC_FOUND_ROWS l.* FROM pmd_v1_listings l INNER JOIN pmd_v1_listings_categories lc ON l.id=lc.list_id WHERE lc.cat_id IN (536,556,557,558,559,560,561,562,563,564,565,566,567,568,569,1849,2564,2565,2601,2602,3005,3059,3060,2566,2567,2568,2569,2570,2603,2824,2825,2826,2881,2882,2883,2604,570,571,572,573,574,575,576,577,578,579,580,3178,581,582,583,584,585,586,587,589,590,591,593,596,597,598,599,600,601,602,603,604,605,606,607,608,609,610,2757,611,612,613,614,615,616,617,618,619,620,621,622,623,624,625,626,627,628,629,631,632,633,634,635,636,637,638,639,640,641,642,643,3159,3189) AND l.status='active' GROUP BY l.id ORDER BY priority DESC,title LIMIT 0,20

Error:
(2013) Lost connection to MySQL server during query

A fatal MySQL error occured.

Query:
REPLACE INTO pmd_v1_sessions VALUES ('51227b1737eaf1e74f1b030aad2e093d','initiated|b:1;',1513009847,'94082a50c352b78159112f3c522b5d0d')

Error:
(2006) MySQL server has gone away