当前位置:网站首页>[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 .
边栏推荐
- C實現貪吃蛇小遊戲
- Stc8h development (XII): I2C drive AT24C08, at24c32 series EEPROM storage
- Win10 clear quick access - leave no trace
- AWT introduction
- Weekly summary (*63): about positive energy
- QT QTableWidget 表格列置顶需求的思路和代码
- My NVIDIA developer journey - optimizing graphics card performance
- Detailed explanation of common APIs for component and container containers: frame, panel, scrollpane
- 手动对list进行分页(参数list ,当前页,页面大小)
- Gridview出现滚动条,组件冲突,如何解决
猜你喜欢
随机推荐
How to avoid JVM memory leakage?
采用中微BATG135实现IIC数据/指令交互
Abap:ooalv realizes the function of adding, deleting, modifying and checking
MySQL information_ Schema database
C语言中的函数(详解)
ES6 modularization
How to get the parent node of all nodes in El tree
Component、Container容器常用API详解:Frame、Panel、ScrollPane
Compound nonlinear feedback control (2)
QT 获取随机颜色值设置label背景色 代码
24 magicaccessorimpl can access the debugging of all methods
Leetcode question brushing record | 206_ Reverse linked list
Learning multi-level structural information for small organ segmentation
Understanding of cross domain and how to solve cross domain problems
Invalid bound statement (not found): com. example. mapper. TblUserRecordMapper. login
Matlab remainder
My NVIDIA developer journey - optimizing graphics card performance
报错cvc-complex-type.2.4.a: 发现了以元素 ‘base-extension‘ 开头的无效内容。应以 ‘{layoutlib}‘ 之一开头。
JS how to convert seconds into hours, minutes and seconds display
The solution of win11 taskbar right click without Task Manager - add win11 taskbar right click function




![[microservice] Nacos cluster building and loading file configuration](/img/50/7af220c57a06eb186729c9882d9dab.png)




