国产探花免费观看_亚洲丰满少妇自慰呻吟_97日韩有码在线_资源在线日韩欧美_一区二区精品毛片,辰东完美世界有声小说,欢乐颂第一季,yy玄幻小说排行榜完本

首頁 > 數(shù)據(jù)庫 > MySQL > 正文

mysql連接數(shù)設(shè)置操作方法(Too many connections)

2024-07-24 13:12:41
字體:
供稿:網(wǎng)友

mysql在使用過程中,發(fā)現(xiàn)連接數(shù)超了~~~~

[root@linux-node1 ~]# mysql -u glance -h 192.168.1.17 -p

Enter password:

ERROR 1040 (08004): Too many connections

解決辦法,這也是centos7下修改mysql連接數(shù)的做法:

1)臨時(shí)修改

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)

2)永久修改:

配置/etc/my.cnf
[mysqld]新添加一行如下參數(shù):
max_connections=1000
重啟mariadb服務(wù),再次查看mariadb數(shù)據(jù)庫最大連接數(shù),可以看到最大連接數(shù)是214,并非我們設(shè)置的1000。
MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 214 |
+-----------------+-------+
這是由于mariadb有默認(rèn)打開文件數(shù)限制。可以通過配置/usr/lib/systemd/system/mariadb.service來調(diào)大打開文件數(shù)目。

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

[Service]新添加兩行如下參數(shù):
LimitNOFILE=10000
LimitNPROC=10000

重新加載系統(tǒng)服務(wù),并重啟mariadb服務(wù)

systemctl --system daemon-reload
systemctl restart mariadb.service

再次查看mariadb數(shù)據(jù)庫最大連接數(shù),可以看到最大連接數(shù)已經(jīng)是1000

MariaDB [(none)]> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 1000 |
+-----------------+-------+

以上這篇mysql連接數(shù)設(shè)置操作方法(Too many connections)就是小編分享給大家的全部內(nèi)容了,希望能給大家一個(gè)參考,也希望大家多多支持VeVb武林網(wǎng)。


注:相關(guān)教程知識(shí)閱讀請移步到MYSQL教程頻道。
發(fā)表評論 共有條評論
用戶名: 密碼:
驗(yàn)證碼: 匿名發(fā)表
主站蜘蛛池模板: 漠河县| 平江县| 中山市| 息烽县| 江源县| 英山县| 和政县| 南漳县| 天镇县| 益阳市| 桃江县| 临湘市| 拜城县| 台南县| 扶绥县| 贡觉县| 南江县| 昆山市| 抚松县| 张家口市| 茌平县| 凤阳县| 平遥县| 焦作市| 翼城县| 和田县| 家居| 沛县| 万州区| 尚志市| 辉南县| 仪征市| 南陵县| 辽源市| 合水县| 洞头县| 芦溪县| 城口县| 博白县| 阿图什市| 贵州省|