Mysql error - Got an error reading communication packets
- Last updated: Nov 3, 2023
- Views: 19369
- Author: Admin
Colleagues hello to all.
In today's article, I will tell you about a common problem that happens in the Mysql database.
The error is called "Got an error reading communication packets".
This error is due to the fact that you want to transfer a lot of data in one request, and thus a similar error may occur. To solve this problem, you need to increase the max_allowed_packet variable. The max_allowed_packet variable is responsible for the maximum data size you can transfer in one request.
The default value of the variable max_allowed_packet is 16 megabytes, so let's make sure of this, let's use queries:
mysql> SHOW VARIABLES LIKE 'max_allowed_packet';
Values are specified in bytes.
You can change the values of max_allowed_packet through the configuration file. Let's change the value of the variable from 16 megabytes to 128 megabytes.
$. vim /etc/my.cnf.d/server.cnf
Values are specified in bytes.
Restarting the database.
$. service mysqld restart;
Checking.
mysql> SHOW VARIABLES LIKE 'max_allowed_packet';
Thank you all, I hope my article was of some help to you.