mysql hints the solution of got timeout reading communication packets

  • 2021-12-04 11:35:25
  • OfStack

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

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

mysql > show gloable variables like "%timeout%";
Perform a view
The value of interactive_timeout is 28800
Default value for wait_timeout This: 120

Increase it according to the situation.
These two values are a global variable and can be dynamically increased, 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)

What can cause an Got timeout reading communication packets error

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

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

A client attempts to access a database but has no privileges for it. (No permissions)

A client uses an incorrect password. (Wrong password)

A connection packet does not contain the right information. (Connection does not contain correct 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 did not call the mysql_close () function)

The client had been sleeping more than wait_timeout or interactive_timeout seconds without issuing requests to the server. (The empty connection time of the client is too long, which exceeds the time of wait_timeout and interactive_timeout)

The client program ended abruptly in the middle of a data transfer. (End during data transfer)

Error troubleshooting:

Because of the problem caused by the asynchronous php function between our mobile phone version and pc, the problem will be solved after careful examination.


Related articles: