Mysql gets an error when executing sql file to import data: Got a packet bigger than 'max_allowed_packet' bytes

MySQL data insertion error: Got a packet bigger than'max_allowed_packet'bytesThis
is caused by the insertion input being too large
. You can view the current value through the command:

show VARIABLES like '%max_allowed_packet%'; 

There can be 2 solutions:

1. Temporary modification, invalid after restarting:
mysql>set global max_allowed_packet=524288000; #修改 512M,具体数值根据情况确定
2. To modify my.cnf (my.ini under windows), you need to restart mysql.

Add a sentence to [MySQLd]the section (if it exists, just adjust its value):

max_allowed_packet=256M #(根据实际情况调整数值)

After modification, use the query command to check whether the modification is successful.

Guess you like

Origin blog.csdn.net/fth1002853070/article/details/134370282
Recommended