max_connections
同時(shí)連接客戶端的最大數(shù)量
# max_connections
默認(rèn)值 151
最小值 1
最大值 100000
查看 max_connections
show global variables like 'max_connections';
設(shè)置 max_connections
set global max_connections = 153; (立即生效重啟后失效)
MySQL 配置文件 my.cnf 中 mysqld 下添加 max_connections
[mysqld]
max_connections = 200
max_connections 還取決于操作系統(tǒng)對(duì)單進(jìn)程允許打開(kāi)最大文件數(shù)的限制
也就是說(shuō)如果操作系統(tǒng)限制單個(gè)進(jìn)程最大可以打開(kāi)100個(gè)文件
那么 max_connections 設(shè)置為200也沒(méi)什么用
MySQL 的 open_files_limit 參數(shù)值是在MySQL啟動(dòng)時(shí)記錄的操作系統(tǒng)對(duì)單進(jìn)程打開(kāi)最大文件數(shù)限制的值
可以使用 show variables like 'open_files_limit'; 查看 open_files_limit 值
或者直接在 Linux 下通過(guò)ulimit -n命令查看操作系統(tǒng)對(duì)單進(jìn)程打開(kāi)最大文件數(shù)限制 ( 默認(rèn)為1024 )