如何增加 MySQL 连接数(max_connections)?
MySQL 数据库的每个套接字的默认连接数为 100,但我正在寻找任何方法来增加可能的连接数 > 100 到 MySQL 数据库的套接字连接.
Every socket of MySQL Database will have defaults connections as 100 but I am looking for any way to increase the number of possible connections > 100 to a socket connection of MySQL Database.
推荐答案
如果你需要在不重启 MySQL 的情况下增加 MySQL 连接数,请执行以下操作
If you need to increase MySQL Connections without MySQL restart do like below
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 100 |
+-----------------+-------+
1 row in set (0.00 sec)
mysql> SET GLOBAL max_connections = 150;
Query OK, 0 rows affected (0.00 sec)
mysql> show variables like 'max_connections';
+-----------------+-------+
| Variable_name | Value |
+-----------------+-------+
| max_connections | 150 |
+-----------------+-------+
1 row in set (0.00 sec)
这些设置将在 MySQL 重启时更改.
These settings will change at MySQL Restart.
对于永久性更改,在 my.cnf 中添加以下行并重新启动 MySQL
For permanent changes add below line in my.cnf and restart MySQL
max_connections = 150
相关文章