# 查看最大连接数

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

# 修改当前服务进程的最大连接数(注意:重启 MySQL 服务后失效)
mysql> set global max_connections = 500;

# 永久修改(修改 MySQL 服务端配置文件)
vim /etc/mysql/mysql.conf.d/mysqld.cnf

# 找到 max_connections 所在行,值改为 500 即可
max_connections = 500

# 查看修改后的效果
root@linux:~# cat /etc/mysql/mysql.conf.d/mysqld.cnf  | grep max_connections
#max_connections        = 100
max_connections         = 500

标签: none

添加新评论