当前位置:网站首页>Mysql: increase the maximum number of connections
Mysql: increase the maximum number of connections
2022-07-27 07:29:00 【TechForGeek】
occasionally , In connection MySQL Database time , The connection will fail , And back to "too many connections" Error message . This is due to the current MySQL Too many connections for , The maximum number of connections allowed has been exceeded .
here , You can try connecting more times MySQL Database or wait a while before connecting . If you have been unable to connect to the database , You need to restart MySQL 了 .
If you try several times , Can be connected to MySQL Database , You can view the current number of connections through the following command :
SHOW STATUS WHERE `variable_name` = 'Threads_connected';And pass SHOW PROCESSLIST [1] Command to view connection details :
SHOW PROCESSLISTconfirm MySQL A large number of connections is a normal connection requirement , Not because of the program bug As a result of , You can improve MySQL Maximum connections limit .
MySQL The default maximum number of connections is 151, You can view it through the following statement :
SHOW VARIABLES LIKE '%max_connections%';take MySQL The maximum number of connections increased to 300:
SET GLOBAL max_connections = 300;Through modification MySQL Variable to modify MySQL Configuration mode , Can be restarted without MySQL In the case of service , To give immediate effect to a modification . But the downside is , stay MySQL After the service is restarted , Your changes will be invalidated .
In order to make our modification lasting , Need modification MySQL Configuration file for . basis MySQL It's installed in different ways , as well as Linux The difference in distribution , The location of the configuration file you need to modify will also be different , For details, please refer to your Linux Distribution documentation and documentation of the installation method you use .
stay Ubuntu 18.04 in , adopt APT Installed MySQL, The configuration file that needs to be modified is /etc/mysql/mysql.conf.d/mysqld.cnf, stay [mysqld] below , Add the following configuration statement :
max_connections = 300Save file and exit .
In this way MySQL After restart , The changes we made will still be valid .
Reference resources :
[1]: https://www.mysqltutorial.org/mysql-show-processlist/
As always, , If you have any questions about the content of the article , Or find any mistakes in the article , You can tell me by leaving a message ; If you like my article , Welcome to my WeChat official account. Tech For Geek.

边栏推荐
- UiAutomator常用类之UI手势动作
- The error of QT connecting SQLite database and its modification
- ADB instruction sorting
- VLAN trunk experiment
- Use Popen to execute a command and get the return result
- jjwt 生成token
- 如何取得对象的DDL信息
- Convert Excel to csv/csv UTF-8
- (posted) comparison of Eureka, consumer and Nacos 1
- C# 常用功能整合-3
猜你喜欢

Esp8266 (esp-12f) third party library use -- sparkfun_ Apds9960 (gesture recognition)

Gossip: Recently, many friends talk about going abroad

Use of tigervnc

jjwt 生成token

(2022杭电多校三)1009.Package Delivery(贪心)

海康h9摄像头用xshell无法连接(没有启用ssh)

零号培训平台课程-2、SSRF基础

vlan间路由(讲解+验证)

TCP/IP协议分析(TCP/IP三次握手&四次挥手+OSI&TCP/IP模型)

Gossip: talk with your daughter about why you should learn culture lessons well
随机推荐
(2022牛客多校三)J-Journey(dijkstra)
12. Integer to Roman整数转罗马数字
SQLite 常用功能整合
Use Popen to execute a command and get the return result
jjwt 生成token
海康h9摄像头用xshell无法连接(没有启用ssh)
Advanced IO outline
sql-labs SQL注入平台-第1关Less-1 GET - Error based - Single quotes - String(基于错误的GET单引号字符型注入)
Py2exe QT interface style becomes Win98 solution
Gossip: talk with your daughter about why you should learn culture lessons well
请教大佬们一个问题,pgsqlcdc任务运行一段时间就不能监测变化了,重启就可以了,这个该从哪方面入
Will Flink CDC constantly occupy Oracle's memory by extracting Oracle's data, and finally cause oracle-040
Generics -- learn it, and there are many benefits
简单的轮播图
The solution of using sqlplus to display Chinese as garbled code
一个优先级顺序的SQL问题
DRConv-pytorch改称输出和输入一样的尺寸
Perl: 将要执行的外部命令拆分为多行
js做一个红绿灯
C语言 pthread_cleanup_push()和pthread_cleanup_pop()函数(用于临界资源程序段中发生终止动作后的资源清理任务,以免造成死锁,临界区资源一般上锁)