Congratulations on your journey;
There are many reasons for this. Let’s not talk about the others. Let’s talk about the problems that occurred today; Eliminate the problem of the database itself (my MySQL does not go down at this time.) it is the problem of the program. This problem is that the process always exists, but it has not operated the database for too long, resulting in the disconnection of the database, but suddenly a piece of data comes. At this time, the process will not re link the database, but use the original link (disconnected at this time), so there is no way to find the database, so this error is reported.
Solution:
$round = mt_rand(1, 10);
if ($round == 6) {
// Query a sql to avoid unavailability of the process due to connection timeout
$dividend = Db::query("select id from think_member_group where `id` = 1");
}
A random number. The core of this method is to let your process check the database every few seconds so that the link will not be disconnected.
Read More:
- MySQL server has gone away Error [How to Solve]
- Mysql Flashback Warning: C:\Program Files\MySQL\MySQL Server 8.0\bin\mysql.exe
- [Solved] ERROR 2002 (HY000): Can’t connect to local MySQL server through socket’/var/lib/mysql/mysql.sock’ (2)
- [Solved] MYSQL Command Execute Error: Can ‘t connect to local MySQL server through socket ‘/tmp/mysql.sock ‘(2) “
- MySql Install Error: Can‘t connect to local MySQL server through socket ‘/tmp/mysql.sock‘
- (Fixed) workbench MySQL Error Code: 2013. Lost connection to MySQL server during query
- How to Solve can‘t connect to local mysql server through socket ‘/var/lib/mysql/mysql.sock‘
- MySQL character set error resolution: err=Error 3988: Conversion from collation utf8mb4_unicode_ci into utf8_general_ci impo
- ERROR 2002 (HY000): Can’t connect to local MySQL server through socket ‘/tmp/mysql.sock’
- MYSQL Enter password:ERROR 2003 (HY000): Can‘t connect to MySQL server on ‘localhost:3306‘
- MYSQL Insert Data Error: check the manual that corresponds to your MySQL server version for the right syntax
- MYSQL 5.7 Error Code: 1290. The MySQL server is running with the –secure-file-priv option so it..
- How to Fix MySQL ERROR 1130 (HY000): Host ‘XXXX’ is not allowed to connect to this MySQL server
- Remote connection to MySQL database error: is not allowed to connect to this MYSQL server solution
- [Solved] MYSQL Error: ERROR! MySQL server PID file could not be found!
- host ‘‘ is not allowed to connect to this mysql server Connect MYSQL Error
- How to Solve MYSQL Error: Failed to start MySQL 8.0 database server
- [Solved] Error Code: 2013. Lost connection to MySQL server during query
- How to Solve SQL state [HY000]: general error 2503
- [Solved] MySQL Error: Client does not support authentication protocol requested by server