Sometimes, when a program connects to MySQL to perform an operational database, a similar error message appears:
Packet for query is too large (4230 > 1024). You can change this value on the server by setting the Max_allowed_packet ' variable.
The general reason for this error is: When sending a query command to the MySQL database, the default condition is that the size of a packet is 1024, the actual length of a statement is the size of this, so the execution of the statement error. The solution is to adjust the size of this parameter in MySQL.
Here's an example of a Linux service solution:
1. Confirm the MySQL installation directory and enter:
/home/apps/mysql-5.7.17-linux-glibc2.5-x86_64
2. Enter the bin directory under MySQL and execute the following command to enter the MySQL command line: (where root password is password)
./mysql-uroot-ppassword
3. Check the package size (MySQL command line execution):
Show variables like '%max_allowed_packet% ';
4. Set the package size (MySQL command line execution):
Set global max_allowed_packet = 100*1024;
5. Exit (execute on MySQL command line)
Quit
6. Stop the MySQL service:
./mysqladmin-uroot-ppassword shutdown
7. Start the service again:
./mysqld--user=mysql &
Packet for query is too large error resolution in MySQL data