查看数据库连接数
/etc/mysql/mysql.conf.d/mysqld.cnf
1、修改/etc/security/limits.conf,添加
root soft nofile 65535
root hard nofile 65535
* soft nofile 65535
* hard nofile 65535
2、修改/lib/systemd/system/mysql.service,添加
LimitNOFILE=65535
LimitNPROC=65535
保存后,执行以下命令
systemctl daemon-reload
systemctl restart mysql.service
mysqladmin -u -p status
数据库配置文件/etc/mysql/mysql.conf.d/mysqld.cnf
注意:如果用 service restart mysql无效,则用systemctl restart mysql
如果修改后生效,但被限制在214,无法再大1、修改/etc/security/limits.conf,添加
root soft nofile 65535
root hard nofile 65535
* soft nofile 65535
* hard nofile 65535
2、修改/lib/systemd/system/mysql.service,添加
LimitNOFILE=65535
LimitNPROC=65535
保存后,执行以下命令
systemctl daemon-reload
systemctl restart mysql.service