#查询
show variables like '%timeout%';
show global variables like '%timeout%';
show session variables like '%timeout%';
#临时设置
set global interactive_timeout=300;
set global wait_timeout=300;
set interactive_timeout=300;
set wait_timeout=300;
[mysqld]
max_connections 10000 #总数
max_user_connections=3000 #每用户连接总数
interactive_timeout=120,300-600 #mysql在关闭一个交互的连接之前所要等待的秒数,默认28800
wait_timeout=120,300-600 #关闭关闭一个非交互的连接之前所要等待的秒数,默认28800
character-set-server=utf8mb4
default-storage-engine=InnoDB #MyIsam
key_buffer_size=384m #MyISAM表性能影响最大的一个参数
#查看 SHOW VARIABLES LIKE '%key_buffer_size%';
#查看命中数量 SHOW GLOBAL STATUS LIKE '%key_read%';
skip-name-resolve=on
#max_user_connections #设置每个用户的连接数
UPDATE mysql.user SET max_user_connections = 1600 WHERE user='lren' AND host='%';
FLUSH PRIVILEGES;
#查看修改结果
show variables like 'max_connections';
show status like 'max_used_connections';
show VARIABLES like '%max_connections%';
show VARIABLES like '%wait_timeout%';
show VARIABLES like '%interactive_timeout%';
#查看当前的连接数和进程数
show status like 'Threads%';