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

React hooks introductory tutorial

State Hooks Examples: import { useState } from &#...

MySQL 5.7.20 compressed version download and installation simple tutorial

1. Download address: http://dev.mysql.com/downloa...

The process of SSH service based on key authentication in Linux system

As we all know, SSH is currently the most reliabl...

The implementation principle of Mysql master-slave synchronization

1. What is MySQL master-slave synchronization? Wh...

Detailed example of jQuery's chain programming style

The implementation principle of chain programming...

Example of how to deploy Spring Boot using Docker

Here we mainly use spring-boot out of the box, wh...

Linux dual network card binding script method example

In Linux operation and configuration work, dual n...

How to install vim editor in Linux (Ubuntu 18.04)

You can go to the Ubuntu official website to down...

Implementation code of front-end HTML skin changing function

50 lines of code to change 5 skin colors, includi...

DOM operation implementation in react

Table of contents Previous words Usage scenarios ...

How to clear floating example code in css

Overview The framework diagram of this article is...

The difference between VOLUME and docker -v in Dockerfile

There are obvious differences between volume moun...

Usage of Node.js http module

Table of contents Preface HTTP HTTP Server File S...

CSS flex several multi-column layout

Basic three-column layout .container{ display: fl...