CentOS7 配置mysql mariadb l数据库最大连接数

1970-01-01 08:00:00 172 0 来源:智智云

系统版本:CentOS7.2 64bit

mysql版本:5.5.47-MariaDB

#############################################################

CentOS7系统调整数据库最大连接数和之前有所不同,如下:

1.查看mariadb数据库最大连接数,默认为151

MariaDB [(none)]> show variables like 'max_connections';

2.配置/etc/my.cnf

[mysqld]新添加一行如下参数:

max_connections=1000

重启mariadb服务,再次查看mariadb数据库最大连接数,可以看到最大连接数是214,并非我们设置的1000。

MariaDB [(none)]> show variables like 'max_connections';

这是由于mariadb有默认打开文件数限制。可以通过配置/usr/lib/systemd/system/mariadb.service来调大打开文件数目。

3.配置/usr/lib/systemd/system/mariadb.service

[Service]新添加两行如下参数:

LimitNOFILE=10000

LimitNPROC=10000

4.重新加载系统服务,并重启mariadb服务

systemctl --system daemon-reloadsystemctl restart mariadb.service

再次查看mariadb数据库最大连接数,可以看到最大连接数已经是1000

  1. MariaDB [(none)]> show variables like 'max_connections';

  2. +-----------------+-------+

  3. | Variable_name   | Value |

  4. +-----------------+-------+

  5. | max_connections | 1000  |



https://blog.csdn.net/hnhuangyiyang/article/details/51132141



我们猜你喜欢
X

截屏,微信识别二维码

客服QQ:406784192

QQ号已复制,请打开微信添加咨询详情!