版本:centos7,mysql5.7
1.编辑mysql配置文件
//编辑mysql配置文件
vim /etc/my.cnf
//在[mysqld]下添加
max_connections=10000
2.编辑mysqld.service配置文件
//编辑/usr/lib/systemd/system/mysqld.service配置文件
vi /usr/lib/systemd/system/mysqld.service
//在尾部添加
LimitNOFILE=65535
LimitNPROC=65535
3.重启mysql服务,使配置生效
systemctl daemon-reload
systemctl restart mysqld.service
4.查询当前最大连接数
//查询最大连接数
show variables like "max_connections";
//当前使用连接数
show global status like 'Max_used_connections';