日韩性视频-久久久蜜桃-www中文字幕-在线中文字幕av-亚洲欧美一区二区三区四区-撸久久-香蕉视频一区-久久无码精品丰满人妻-国产高潮av-激情福利社-日韩av网址大全-国产精品久久999-日本五十路在线-性欧美在线-久久99精品波多结衣一区-男女午夜免费视频-黑人极品ⅴideos精品欧美棵-人人妻人人澡人人爽精品欧美一区-日韩一区在线看-欧美a级在线免费观看

歡迎訪問 生活随笔!

生活随笔

當前位置: 首頁 > 运维知识 > 数据库 >内容正文

数据库

mysql max connects_mysql max_connections 总是 4190

發布時間:2025/3/21 数据库 22 豆豆
生活随笔 收集整理的這篇文章主要介紹了 mysql max connects_mysql max_connections 总是 4190 小編覺得挺不錯的,現在分享給大家,幫大家做個參考.

項目中,由于連接數過多,提示“Too many connections”,需要增加連接數。我在 /etc/my.cnf中修改了

max_connections = 3000

但是, 一直都是顯示的 214

mysql> show variables like "max_connections";

+—————–+——-+

| Variable_name?? | Value |

+—————–+——-+

| max_connections | 214?? |

+—————–+——-+

1 row in set+

修改 /usr/lib/systemd/system/mariadb.service

LimitNOFILE=65535

LimitNPROC=65535

systemctl status mariadb

Warning: mariadb.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.

Hint: Some lines were ellipsized, use -l to show in full.

systemctl daemon-reload

systemctl restart mariadb

show variables like ‘%max_connections%’;

extra_max_connections??? 1

max_connections??? 3000??? —恢復和配置一樣

———————————————4190---------------

mysql max_connections 總是??? 4190

Variable_name??? Value

max_connections??? 4190

查mysql open files

show global variables like ‘%open_files_limit%’;

Variable_name??? Value

open_files_limit??? 5000

所以max_connections 不管設多大,都小于5000

-----解決

修改本地openfiles值

到/etc/security/limits.conf這個檔案。

/etc/security/limits.conf

* soft nofile 65536

* hard nofile 65536

查看本地open files

ulimit -a |grep open

open files????????????????????? (-n) 555550

查看

grep LimitNOFILE /usr/lib/systemd/system/mysqld.service

LimitNOFILE = 5000

修改

grep LimitNOFILE /usr/lib/systemd/system/mysqld.service

LimitNOFILE = 50000

reload

Warning: mysqld.service changed on disk. Run ‘systemctl daemon-reload’ to reload units.

重啟

systemctl restart mysqld

驗證

grep max_connections /etc/my.cnf

max_connections=32000

show VARIABLES like "max_connections"

Variable_name??? Value

max_connections??? 32000

修改值與mysql值一致

總結

以上是生活随笔為你收集整理的mysql max connects_mysql max_connections 总是 4190的全部內容,希望文章能夠幫你解決所遇到的問題。

如果覺得生活随笔網站內容還不錯,歡迎將生活随笔推薦給好友。