当前位置:网站首页>[problem record] 03 connect to MySQL database prompt: 1040 too many connections
[problem record] 03 connect to MySQL database prompt: 1040 too many connections
2022-07-04 06:29:00 【joinclear】
1、 The error information is as follows :
Connect MySQL Database prompt :1040 Too many connections:
2、 reason :
Due to the number of database connections , The maximum number of connections to the database has been exceeded .
PS: Because these database connections , be in sleep state , But it has not been cleared away .
View reasons :
1) Log in to the database
logon server , Enter the command :
mysql -uroot -p
Enter the database login password , Login successful .
2) View database process status
show status like 'Threads%';
treads_cached : Number of threads in the buffer pool .
Threads_connected: Current connection ( Running and sleeping ) Number of threads in .
Threads_created : The number of threads that have created connections .
Threads_running: Currently running ( No sleep ) Number of threads in .
A total of :152 individual .
3) View the maximum number of database connections
show variables like '%max_connection%';
maximum connection :151 individual , Less than the current total number of connections 152, So the tip :Too many connections.
4) View clear Sleep Connection time
show variables like 'wait_timeout';
The clearance interval is :28800 second (8 Hours ), After connection 8 Hours clear .
3、 resolvent :
The solution priority is as follows 1、2、3 The order of :
1) Troubleshoot code problems
See where there are too many connections , It may be caused by code, such as scheduled tasks .
2) Increase the maximum number of connections
set GLOBAL max_connections=1000;
such as , Change it to 1000 Number of connections :
3) Reduce and clear Sleep Connection time
set GLOBAL wait_timeout=14400;
Change to 4 Hours or shorter intervals .
边栏推荐
- SQL join, left join, right join usage
- How to avoid JVM memory leakage?
- 7. Agency mode
- LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout
- How to solve the component conflicts caused by scrollbars in GridView
- 198. House raiding
- Variables d'environnement personnalisées uniapp
- QT 获取随机颜色值设置label背景色 代码
- Review | categories and mechanisms of action of covid-19 neutralizing antibodies and small molecule drugs
- How to implement cross domain requests
猜你喜欢
746. Climb stairs with minimum cost
High performance parallel programming and optimization | lesson 02 homework at home
Review | categories and mechanisms of action of covid-19 neutralizing antibodies and small molecule drugs
C實現貪吃蛇小遊戲
Appium foundation - appium installation (II)
Notes and notes
QT get random color value and set label background color code
Leakage detection relay jy82-2p
Learn about the Internet of things protocol WiFi ZigBee Bluetooth, etc. --- WiFi and WiFi protocols start from WiFi. What do we need to know about WiFi protocol itself?
Distributed cap theory
随机推荐
A little understanding of GSLB (global server load balance) technology
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
JS how to convert seconds into hours, minutes and seconds display
Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
MySQL installation and configuration
JS get the attribute values nested in the object
198. House raiding
Uniapp custom environment variables
[Android reverse] function interception (CPU cache mechanism | CPU cache mechanism causes function interception failure)
Compound nonlinear feedback control (2)
LayoutManager布局管理器:FlowLayout、BorderLayout、GridLayout、GridBagLayout、CardLayout、BoxLayout
Lightroom import picture gray / Black rectangular multi display
Qt发布多语言国际化翻译
The width of the picture in rich text used by wechat applet exceeds the problem
Variables d'environnement personnalisées uniapp
QT qtablewidget table column top requirements ideas and codes
[microservice] Nacos cluster building and loading file configuration
ES6 模块化
Inputstream/outputstream (input and output of file)
JS execution mechanism