《MysqL数据库MysqL连接数设置 *** 作方法(Too many connections)》要点:
本文介绍了MysqL数据库MysqL连接数设置 *** 作方法(Too many connections),希望对您有用。如果有疑问,可以联系我们。
MysqL在使用过程中,发现连接数超了~~~~MysqL必读
[root@linux-node1 ~]# MysqL -u glance -h 192.168.1.17 -p
MysqL必读
Enter password:MysqL必读
ERROR 1040 (08004): Too many connectionsMysqL必读
解决办法,这也是centos7下修改MysqL连接数的做法:
MysqL必读
1)临时修改
MysqL必读
MariaDB [(none)]> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
1 row in set (0.00 sec)
MariaDB [(none)]> set GLOBAL max_connections=1000;
query OK,0 rows affected (0.00 sec)
MariaDB [(none)]> show variables like "max_connections";
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+
1 row in set (0.00 sec)MysqL必读
2)永久修改:
MysqL必读
配置/etc/my.cnf
[MysqLd]新添加一行如下参数:
max_connections=1000
重启mariadb服务,再次查看mariadb数据库最大连接数,可以看到最大连接数是214,并非我们设置的1000.
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
这是由于mariadb有默认打开文件数限制.可以通过配置/usr/lib/systemd/system/mariadb.service来调大打开文件数目.MysqL必读
配置/usr/lib/systemd/system/mariadb.service
MysqL必读
[Service]新添加两行如下参数:
limitNOfile=10000
limitNPROC=10000MysqL必读
重新加载系统服务,并重启mariadb服务
MysqL必读
systemctl --system daemon-reload
systemctl restart mariadb.serviceMysqL必读
再次查看mariadb数据库最大连接数,可以看到最大连接数已经是1000
MysqL必读
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+MysqL必读
以上这篇MysqL连接数设置 *** 作方法(Too many connections)就是小编分享给大家的全部内容了,希望能给大家一个参考,也希望大家多多支持内存溢出PHP.MysqL必读
总结以上是内存溢出为你收集整理的MYSQL数据库mysql连接数设置 *** 作方法(Too many connections)全部内容,希望文章能够帮你解决MYSQL数据库mysql连接数设置 *** 作方法(Too many connections)所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)