Solution to mysql prompt "got timeout reading communication packets"

Solution to mysql prompt "got timeout reading communication packets"

Error message:
user: 'root' host: `localhost' (Got timeout reading communication packets)
MYSQL server has gone away

The cause of this is not terrible. The reason is that the system disconnection time has been changed.

mysql>show gloable variables like "%timeout%";
View
The default value for interactive_timeout is 28800
The default value of wait_timeout is: 120

Increase it according to the situation.
These two values ​​are global variables and can be increased dynamically, such as:
mysql> set global interactive_timeout=28800;
Query OK, 0 rows affected (0.00 sec)
mysql> show global variables like "interactive_timeout";
+---------------------+-------+
| Variable_name | Value |
+---------------------+-------+
| interactive_timeout | 28800 |
+---------------------+-------+
1 row in set (0.00 sec)

Causes of the Got timeout reading communication packets error

https://dev.mysql.com/doc/refman/5.5/en/communication-errors.html

There are several possible reasons for the Got Timeout reading communication packets error:

A client attempts to access a database but has no privileges for it.

A client uses an incorrect password.

A connection packet does not contain the right information.

It takes more than connect_timeout seconds to obtain a connect packet.

The client program did not call mysql_close() before exiting.

The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing any requests to the server.

The client program ended abruptly in the middle of a data transfer.

Troubleshooting:

The problem was caused by the PHP functions on our mobile version being out of sync with the PHP functions on the PC version, so a careful check solved the problem.

<<:  Summary of three methods of lazy loading lazyLoad using native JS

>>:  Tutorial on building an FTP server in Ubuntu 16.04

Recommend

In-depth analysis of HTML semantics and its related front-end frameworks

About semantics Semantics is the study of the rel...

Tomcat uses Log4j to output catalina.out log

Tomcat's default log uses java.util.logging, ...

Detailed explanation of Vue's calculated properties

1. What is a calculated attribute? In plain words...

vmware virtual machine ubuntu18.04 installation tutorial

Installation Steps 1. Create a virtual machine 2....

Detailed tutorial for downloading and installing mysql8.0.21

Official website address: https://www.mysql.com/ ...

Angular framework detailed explanation of view abstract definition

Preface As a front-end framework designed "f...

JavaScript to achieve progress bar effect

This article example shares the specific code of ...

Detailed explanation of Nginx process scheduling problem

Nginx uses a fixed number of multi-process models...

Solution to forgetting mysql password under linux

The problem is as follows: I entered the command ...

MySQL paging analysis principle and efficiency improvement

MySQL paging analysis principle and efficiency im...

A detailed discussion of MySQL deadlock and logs

Recently, several data anomalies have occurred in...