Mysql error - Got an error reading communication packets

Mysql error - Got an error reading communication packets

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';

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

max_allowed_packet

Values ​​are specified in bytes.

 

Restarting the database.

$. service mysqld restart;

 

Checking.

mysql> SHOW VARIABLES LIKE 'max_allowed_packet';

max_allowed_packet


 

 Thank you all, I hope my article was of some help to you.

SIMILAR ARTICLES

MySQL - Test Data Generation
MySQL - Test Data Generation
MYSQL
Read more
MySQL / MariaDB How to get the id of the last inserted record in a table - LAST_INSERT_ID
MySQL / MariaDB How to get the id of the last inserted record in a table - LAST_INSERT_ID
MYSQL
Read more
MySQL/MariaDB How to convert character case - UPPER and LOWER functions
MySQL/MariaDB How to convert character case - UPPER and LOWER functions
MYSQL
Read more