mysql+超过连接数的查询,mysql貌似因为连接数太大而连接不上,根据网上的教程,写份查询连接数命令的总结...

首先是要进入到mysql的命令行,

然后执行语句

查询最大可连接数

show variables like '%max_connections%';

6a39c9916da1f9f9b06a7dbbd709a141.png

查询一下当前的连接数

show processlist;

95b4b1cb3aa1da86d0ba12318d605d02.png

或者这条语句也同样可以查询

show status like 'Threads%';

73cdaf8a01278ebc3004b73f79e56deb.png

这里面的Threads_connected即为连接数。

-------------------------------------------------------------------------------

(单行线内的内容,唔,未必需要看)

而其他的参数

Threads_cached在使用手册上的解释是

The number of threads in the thread cache.

This variable is not meaningful in the embedded server (libmysqld) and as of MySQL 5.7.2 is no

longer visible within the embedded server.

译为

线程缓存中的连接数.

这个参数在嵌入式服务器(libmysqld )中没有意义,而从mysql 5.7.2开始在嵌入式服务器内这个参数就不再存在(唔,应该是这个意思)

Threads_connected

The number of currently open connections.

译为

当前打开的连接数

Theads_created

The number of threads created to handle connections. If Threads_created is big, you may

want to increase the thread_cache_size value. The cache miss rate can be calculated as

Threads_created/Connections.

这个数量代表着:为了处理链接,创建的线程有多少条。如果这个数量很大,你可以去增加thread_cache_size的值.这个缓存丢失率等于 Threads_created除以Connections.

Thread_running

The number of threads that are not sleeping.

并未处于休眠状态的线程数量。

---------------------------------------------------------------------------------

如果运行中的数量很大的话,可以将数据库可运行数量增大,或者直接重启数据库。

如果是linux下的话

service mysqld restart

  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值