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

查看:201
本文介绍了如何增加MySQL连接(max_connections)?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

MySQL数据库的每个套接字都将默认连接为100,但我正在寻找任何方式增加可能连接的数量> 100到MySQL数据库的套接字连接。

解决方案

如果您需要增加MySQL连接而不需要重新启动MySQL,请像下面

  mysql>显示变量如'max_connections'; 
+ ----------------- + ------- +
| Variable_name |价值|
+ ----------------- + ------- +
| max_connections | 100 |
+ ----------------- + ------- +
集合中的1行(0.00秒)

mysql> SET GLOBAL max_connections = 150;
查询OK,0行受影响(0.00秒)

mysql>显示变量如'max_connections';
+ ----------------- + ------- +
| Variable_name |价值|
+ ----------------- + ------- +
| max_connections | 150 |
+ ----------------- + ------- +
集合中的1行(0.00秒)



这些设置将在MySQL重新启动时更改。






对于永久性更改,请在my.cnf中添加以下行并重新启动MySQL

  max_connections = 150 


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.

解决方案

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)

These settings will change at MySQL Restart.


For permanent changes add below line in my.cnf and restart MySQL

max_connections = 150

这篇关于如何增加MySQL连接(max_connections)?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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