SQL/CSV importing error: Got a packet bigger than ‘max_allowed_packet’ bytes

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.

Posted on
Deprecated: Creation of dynamic property WP_Term::$cat_ID is deprecated in /home/testadnan/adnan.pk/innovator/wp-includes/category.php on line 378

Deprecated: Creation of dynamic property WP_Term::$category_count is deprecated in /home/testadnan/adnan.pk/innovator/wp-includes/category.php on line 379

Deprecated: Creation of dynamic property WP_Term::$category_description is deprecated in /home/testadnan/adnan.pk/innovator/wp-includes/category.php on line 380

Deprecated: Creation of dynamic property WP_Term::$cat_name is deprecated in /home/testadnan/adnan.pk/innovator/wp-includes/category.php on line 381

Deprecated: Creation of dynamic property WP_Term::$category_nicename is deprecated in /home/testadnan/adnan.pk/innovator/wp-includes/category.php on line 382

Deprecated: Creation of dynamic property WP_Term::$category_parent is deprecated in /home/testadnan/adnan.pk/innovator/wp-includes/category.php on line 383
Categories PHPTags , ,

Deprecated: Creation of dynamic property WP_Query::$comments_by_type is deprecated in /home/testadnan/adnan.pk/innovator/wp-includes/comment-template.php on line 1528

Leave a Reply

Your email address will not be published.