Network Security Internet Technology Development Database Servers Mobile Phone Android Software Apple Software Computer Software News IT Information

In addition to Weibo, there is also WeChat

Please pay attention

WeChat public account

Shulou

Mysql maximum number of connections settin

2025-04-02 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)06/01 Report--

Problem description: many times you will encounter the exception of "MySQL: ERROR 1040: Too many connections".

Problem analysis: one reason for this situation is that the number of visits is too high and the MySQL server cannot resist. At this time, you should consider increasing the decentralized reading pressure from the server; another reason is that the max_connections value in the MySQL configuration file is too small. (after the MySQL database is installed, the default MySQL database has a maximum number of connections of 100)

First, let's take a look at the maximum number of connections to mysql:

Log in to mysql

Mysql > show variables like'% max_connections%'; view maximum number of connections

There are two ways to modify the maximum number of connections:

1. Temporary settin

Log in to mysql:

Mysql > set global max_connections=1000

This method will fail after restarting mysql

two。 Permanent settin

Modify the configuration file my.cnf of mysql

Add max_connections = 1000 to [mysqld]

[mysqld]

Max_connections = 1000

Restart mysql after saving and exiting

Finally:

Share my Aliyun lucky coupon (if you need to purchase Aliyun service, you can get it): https://promotion.aliyun.com/ntms/act/ambassador/sharetouser.html?userCode=rziak7l4&utm_source=rziak7l4

Welcome to subscribe "Shulou Technology Information " to get latest news, interesting things and hot topics in the IT industry, and controls the hottest and latest Internet news, technology news and IT industry trends.

Views: 0

*The comments in the above article only represent the author's personal views and do not represent the views and positions of this website. If you have more insights, please feel free to contribute and share.

Share To

Database

Wechat

© 2024 shulou.com SLNews company. All rights reserved.

12
Report