2024-07-12
한어Русский языкEnglishFrançaisIndonesianSanskrit日本語DeutschPortuguêsΕλληνικάespañolItalianoSuomalainenLatina
Operating environment: Winows11, Phpstudy V8.1.1.3, MySQL 5.7.26
There is a limit on the number of MySQL connections at the same time. When the limit is exceeded, the following error message will be displayed:
1040 - Too many connections
View the current maximum number of connections
mysql> show variables like '%max_connection%';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 100 |
+-----------------+-------+
Modify the maximum number of connections
set global max_connections=500;
Operating environment: Winows11 + Phpstudy V8.1.1.3
After entering the MySQL command line, if you connect to the MySQL service for a long time without performing any operation, the MySQL service will be automatically disconnected. When you perform the operation again, the following prompt will appear:
ERROR 2006 (HY000): MySQL server has gone away
No connection. Trying to reconnect...
Connection id: 2
Current database: liang
Check out the two ways to write the timeout (the default timeout is 120 seconds):
select @@wait_timeout;
show variables like 'wait_timeout';
The current session timeout is set to 700 seconds
set @@wait_timeout = 700;