How to increase MySQL connections(max_connections)?(如何增加 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
这篇关于如何增加 MySQL 连接数(max_connections)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持编程学习网!
本文标题为:如何增加 MySQL 连接数(max_connections)?


- 更改自动增量起始编号? 2021-01-01
- 以一个值为轴心,但将一行上的数据按另一行分组? 2022-01-01
- 使用 Oracle PL/SQL developer 生成测试数据 2021-01-01
- SQL 临时表问题 2022-01-01
- 远程 mySQL 连接抛出“无法使用旧的不安全身份验证连接到 MySQL 4.1+"来自 XAMPP 的错误 2022-01-01
- 如何将 SonarQube 6.7 从 MySQL 迁移到 postgresql 2022-01-01
- 如何使用 pip 安装 Python MySQLdb 模块? 2021-01-01
- 如何将 Byte[] 插入 SQL Server VARBINARY 列 2021-01-01
- 导入具有可变标题的 Excel 文件 2021-01-01
- 在SQL中,如何为每个组选择前2行 2021-01-01