today i have trying to export and import a large database. but when i used to import or export that data i got an error like
Got a packet bigger than ‘max_allowed_packet’ bytes
i got this error because mysql default packet size samll. if data is gather than 1Mb we need to reset the default packet size. we can do this by this command
set max_allowed_packet=1000*1024*1024;
set net_buffer_length=1000000;
or
set GLOBAL max_allowed_packet=1000*1024*1024;
set GLOBAL net_buffer_length=1000000;
check if it is set or not by this
select @@max_allowed_packet;
Note that the @@ operator works in global scope when setting up a variable, while when fetching a variable, it will retrieve the session one and if it’s not found, the global one. The reason for using session vars is that they are set per client, so a mysql restart won’t be necessary. They also don’t require SUPER privileges.