1、安装好mysql服务
2、编辑mysql配置文件
vim /etc/my.cnf
3、在[mysqld]分段下添加一行:
max_connections=65535
4、编辑 /etc/systemd
vim /etc/systemd/system.conf
打开注释,并修改值为65535:
DefaultLimitNOFILE=65535
DefaultLimitNPROC=65535
修改了system.conf后,需要重启系统才会生效。
5、重启使mysql配置生效
systemctl daemon-reload
systemctl restart mysqld.service
6、查看连接数
第一种:命令行查看和修改最大连接数(max_connections)。
>mysql -uuser -ppassword(命令行登录MySQL)
mysql>show variables
like
'max_connections'
;(查可以看当前的最大连接数)
参照博客:
1、CentOS/RHEL 7 系统中设置systemd service的ulimit资源限制
http://smilejay.com/2016/06/centos-7-systemd-conf-limits/
2、