If you are working on XAMPP then you can fix the MySQL Server has gone away issue with following changes..
open your my.ini file my.ini location is (D:\xampp\mysql\bin\my.ini)
change the following variable values
max_allowed_packet = 64M
innodb_lock_wait_timeout = 500