I got this error today when I was importing a CSV file in MYSQL using phpMyAdmin. This error can be with SQL importing as well. It appears because of some (let’s say description) field needs to extend its length. After searching a lot on web, I found I would need to edit my.cnf file variable ‘max_allowed_packet’ to maximum bytes. If you are doing this on your local machine or VPS you can edit file directly. but there is another nicer way to do that.
1. Go to your SQL tab of your phpMyAdmin and run the following lines
a) SHOW VARIABLES LIKE ‘max_allowed_packet’;
b) SHOW SESSION VARIABLES LIKE ‘max_allowed_packet’;
Above two commands will return you the current maximum bytes allowed by fields. Input the below commands to set these variables
set global net_buffer_length=99999999;
set global max_allowed_packet=99999999;
and then you are done. Run your CSV or SQL and you will get success!!
This was my experience with this problem. If you have any other experience or something, share with me in Comments, Thanks.