简体   繁体   English

mysql连接过多问题

[英]mysql too many connection problems

I'm currently working on maintenance of an old project. 我目前正在维护一个旧项目。 I have "too many connection problem".I know the error is on the code(not closing connections), but to investigate each frame required more time. 我有“太多连接问题”。我知道错误是在代码上(不是关闭连接),但是要研究每个帧需要更多时间。 " I'm looking for a way to close all connections that are sleep or idle for a long time or if the connection pool is maximum ". 我正在寻找一种方法来关闭所有长时间处于睡眠或空闲状态或连接池最大的连接 ”。

Increase your connections by using set global max connections . 通过使用set global max connections来增加set global max connections

Below: 下面:

show variables like "max_connections";

set global max_connections = 200;

if(connection.State==ConnectionState.Open)
{
 connection.Close();
}

Try with this.! 试试这个!

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM