当前位置:网站首页>[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 .
边栏推荐
- Leetcode question brushing record | 206_ Reverse linked list
- Layoutmanager layout manager: flowlayout, borderlayout, GridLayout, gridbaglayout, CardLayout, BoxLayout
- Invalid revision: 3.18.1-g262b901-dirty
- How to help others effectively
- [untitled]
- Sort list tool class, which can sort strings
- Practical gadget instructions
- Which water in the environment needs water quality monitoring
- C实现贪吃蛇小游戏
- C language exercises (recursion)
猜你喜欢

C realize Snake games

Which water in the environment needs water quality monitoring

uniapp 自定义环境变量

gslb(global server load balance)技术的一点理解
![[March 3, 2019] MAC starts redis](/img/ff/88638fcdc8d24dc268781c224e8195.jpg)
[March 3, 2019] MAC starts redis

HMS v1.0 appointment. PHP editid parameter SQL injection vulnerability (cve-2022-25491)

How does apscheduler set tasks not to be concurrent (that is, execute the next task after the first one)?

746. Climb stairs with minimum cost

C réaliser des jeux de serpents gourmands

Configure cross compilation tool chain and environment variables
随机推荐
Compound nonlinear feedback control (2)
对List进行排序工具类,可以对字符串排序
C # symmetric encryption (AES encryption) ciphertext results generated each time, different ideas, code sharing
JS execution mechanism
Sleep quality today 78 points
JSON Web Token----JWT和傳統session登錄認證對比
报错cvc-complex-type.2.4.a: 发现了以元素 ‘base-extension‘ 开头的无效内容。应以 ‘{layoutlib}‘ 之一开头。
Lightroom import picture gray / Black rectangular multi display
R统计绘图-随机森林分类分析及物种丰度差异检验组合图
我的NVIDIA开发者之旅——优化显卡性能
【无标题】
Error CVC complex type 2.4. a: Invalid content beginning with element 'base extension' was found. Should start with one of '{layoutlib}'.
ES6 modularization
Cloud native - SSH article that must be read on the cloud (commonly used for remote login to ECS)
[untitled]
[openvino+paddle] paddle detection / OCR / SEG export based on paddle2onnx
QT get random color value and set label background color code
SQL injection SQL lab 11~22
Detectron:训练自己的数据集——将自己的数据格式转换成COCO格式
Review | categories and mechanisms of action of covid-19 neutralizing antibodies and small molecule drugs