如何配置mysql的连接数?
程序员文章站
2022-09-02 22:57:36
通过命令获取:
show global status like ‘Max_used_connections’;
show variables like...
通过命令获取:
show global status like ‘Max_used_connections’;
show variables like ‘max_connections’;
当Max_used_connections / max_connections * 100% ≈ 85% 为比较理想的状态。
我是使用C# 进行数据库字符串连接同时设置了连接池最大连接数:
public string Conn = “Database=’parking’;Data Source=’” + ip + “’;User Id=’” + user + “’;Password=’” + password + “’;Port=” + port + “;charset=’utf8’;pooling=true;max pool size=100;min pool size=2;Allow Zero Datetime=True”;