版本: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';