记mysql 在配置文件修改 max_connections 后重启重置为 214

参阅https://www.cnblogs.com/baiyb/p/9281517.html

参阅https://blog.csdn.net/zwlsuperman/article/details/81333890

 

总结:

mysql 的 max_connections 参数 和本身操作系统的open-file-limit有关。

官方文档描述为

The maximum number of connections MySQL can support depends on the quality of the thread library on a given platform, the amount of RAM available, how much RAM is used for each connection, the workload from each connection, and the desired response time. Increasing open-files-limit may be necessary. Also see Section 2.5, “Installing MySQL on Linux”, for how to raise the operating system limit on how many handles can be used by MySQL.

 

修改步骤

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
(注:此处路径可能与系统有关, 若不在 /lib/systemd/system 路径下可以确认是否存在于 /usr/lib/systemd/system 路径下)

 

3、执行命令
systemctl daemon-reload
systemctl restart mysql.service

 

还遇见了其它说法,apt、yum、rpm 方式安装的mysql在对max_connection的限制也不同。

评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值