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

Detailed explanation of samba + OPENldap to build a file sharing server

Here I use samba (file sharing service) v4.9.1 + ...

How to install Solr 8.6.2 in Docker and configure the Chinese word segmenter

1. Environment version Docker version 19.03.12 ce...

Example code of Vue3 encapsulated magnifying glass component

Table of contents Component Infrastructure Purpos...

MySQL query example explanation through instantiated object parameters

This article will introduce how to query data in ...

MySQL 5.7.18 Green Edition Download and Installation Tutorial

This article records the detailed process of down...

Summary of 11 amazing JavaScript code refactoring best practices

Table of contents 1. Extracting functions 2. Merg...

MySQL case when group by example

A mysql-like php switch case statement. select xx...

Solution to garbled display of Linux SecureCRT

Let's take a look at the situation where Secu...

Explanation of the problem that JavaScript strict mode does not support octal

Regarding the issue that JavaScript strict mode d...

MySQL Installer 8.0.21 installation tutorial with pictures and text

1. Reason I just needed to reinstall MySQL on a n...

Html and CSS Basics (Must Read)

(1) HTML: HyperText Markup Language, which mainly...

Detailed explanation of MySQL date addition and subtraction functions

1. addtime() Add the specified number of seconds ...

Linux system AutoFs automatic mount service installation and configuration

Table of contents Preface 1. Install the service ...

A solution to a bug in IE6 with jquery-multiselect

When using jquery-multiselect (a control that tra...