首页 > 数据库 >MySQL 解决Too many connections方法,修改max_connections系统环境变量。

MySQL 解决Too many connections方法,修改max_connections系统环境变量。

时间:2022-10-25 10:33:55浏览次数:68  
标签:-- max 连接数 connections mysql many 环境变量

出现这个问题,一版是数据库的最大连接数不够用了,需要进行修改max_connections系统环境变量的值。

-- 显示当前最大连接数
show variables like '%max_connections%';
-- 显示用户的最大连接数
show variables like '%max_user_connections%';

show variables like '%open_files_limit%';

-- 显示当前自服务器启动以来,一直在同时使用的最大连接数。
show global status like 'Max_used_connections';

设置max_connections系统环境变量的值

-- 设置mysql最大连接数,不过是临时的,只是本次mysql运行中有效。
SET GLOBAL max_connections = 1000;

-- 要将全局系统变量持久化到数据目录中的mysqld-auto.cnf选项文件中,在变量名前面加上**PERSIST**关键字:
SET PERSIST max_connections = 1000; 

结束

引用

常见问题 - Too many connections
set设置环境变量语法
mysql max_connections文档
mysql max_user_connections文档
mysql 状态变量Max_used_connections

标签:--,max,连接数,connections,mysql,many,环境变量
From: https://www.cnblogs.com/XingXiaoMeng/p/16824039.html

相关文章