如何增加 MySQL 连接数(max_connections)? [英] How to increase MySQL connections(max_connections)?

查看:51
本文介绍了如何增加 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)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆