设置MYSQL最大连接数与WAIT_TIMEOUT

时间:2022-10-03 14:32:17

设置mysql最大连接数

mysql -u root -p//首先登录MYSQL命令行
Enter password:

修改最大连接数

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

修改 wait_timeout
一开始用Mysql命令行修改发现重启后失效,用

# 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