MySQL - 已达到数字连接 [英] MySQL - number connection reached
问题描述
在我的网络主机中,我每小时限制为15000个连接。如何检查已经达到的连接数量?有什么办法吗?
我需要一个解决方案在PHP mysqli查询,如果可能。
在MySQL中,您可以查询
显示全局状态
获取服务器统计信息的完整列表。您会看到所需的资料:
- 连接(总连接是否成功)
- Thread_connected (总活动连接数,如果要检查活动连接,则非常有用)
,但是您无法在最后一个小时本地获取创建的连接。相反,您可以每小时请求此数据并存储以前的值,因此您所需的计数将在实际和上一个连接
值之间有所不同。
提示:只能获取所需的变量,您可以查询:
SHOW GLOBAL状态LIKE'连接'
In my web host I have a limit of 15000 connections per hour. How can I check the number of connections already reached? Is there any way? I need a solution in PHP mysqli query, if possible.
Yes, there is. In MySQL you can query
SHOW GLOBAL STATUS
to get full listing of server's stats. There you will see what you needed:
- Connections (total connections successful or not)
- Thread_connected (total active connections, useful if you want to check active connections)
but you can not get created connections per last hour natively. Instead you can request this data each hour and store previous value, so your desired count would be difference between actual and previous Connections
values.
hint: to get only desired variable you can query like:
SHOW GLOBAL STATUS LIKE 'Connections'
这篇关于MySQL - 已达到数字连接的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!