如何增加 MySQL 连接数(max_connections)?

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

本站部分内容来源互联网,如果有图片或者内容侵犯您的权益请联系我们删除!

相关文档推荐

Hibernate reactive No Vert.x context active in aws rds(AWS RDS中的休眠反应性非Vert.x上下文处于活动状态)
Bulk insert with mysql2 and NodeJs throws 500(使用mysql2和NodeJS的大容量插入抛出500)
Flask + PyMySQL giving error no attribute #39;settimeout#39;(FlASK+PyMySQL给出错误,没有属性#39;setTimeout#39;)
auto_increment column for a group of rows?(一组行的AUTO_INCREMENT列?)
Sort by ID DESC(按ID代码排序)
SQL/MySQL: split a quantity value into multiple rows by date(SQL/MySQL:按日期将数量值拆分为多行)