设置MYSQL最大连接数与WAIT_TIMEOUT

时间:2022-10-03 13:48:53

设置mysql最大连接数

登录

mysql -u root -p
Enter password: 

修改最大连接数

mysql> set GLOBAL max_connections=200;
Query OK, 0 rows affected (0.00 sec)

修改 wait_timeout

# vi /etc/my.cnf

[mysqld]
wait_timeout=60
mysql> show global variables like 'wait_time';
Empty set (0.00 sec)

mysql> show global variables like 'wait_timeout'; +---------------+-------+
| Variable_name | Value | +---------------+-------+
| wait_timeout | 60 | +---------------+-------+
1 row in set (0.00 sec)

最后别忘了重启服务

service mysqld restart
Redirecting to /bin/systemctl restart  mysqld.service