- 工信部備案號 滇ICP備05000110號-1
- 滇公安備案 滇53010302000111
- 增值電信業(yè)務(wù)經(jīng)營許可證 B1.B2-20181647、滇B1.B2-20190004
- 云南互聯(lián)網(wǎng)協(xié)會理事單位
- 安全聯(lián)盟認(rèn)證網(wǎng)站身份V標(biāo)記
- 域名注冊服務(wù)機構(gòu)許可:滇D3-20230001
- 代理域名注冊服務(wù)機構(gòu):新網(wǎng)數(shù)碼
MySQL報錯Can not connect to MySQL server. Too many connections,報錯很明確,與MySQL的連接數(shù)滿了。mysql最大連接數(shù)默認(rèn)為100,看來有必要改大一點了。
方法:修改配置,然后重啟
vi /etc/m.cnf加入max_connections=1024,然后重啟mysql即可。
需要注意的是有時候重啟后max_connections變成了214,這就很詭異了。
查閱了官方文檔:
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.
把上述語句概括起來就是,max_connections依托于操作系統(tǒng),Linux系統(tǒng)必要時需要增加open-files-limit。萬萬沒想到啊,修改max_connections竟然要修改操作系統(tǒng)最大文件描述符。
vi /usr/lib/systemd/system/mysqld.service加入
LimitNOFILE=50000
重啟MySQL
售前咨詢
售后咨詢
備案咨詢
二維碼
TOP