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

Maximum number of connections to MySQL database

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

Share

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

Background knowledge:

MySQL maximum number of connections default value is 100, for a large number of concurrent connections database, when the connection request is greater than the default number of connections, there will be an error can not connect to the database, so we need to increase it appropriately, when using MySQL database, often encounter such a problem, that is,"Can not connect to MySQL server." Too many connections"-mysql 1040 error, this is because the number of unreleased connections accessing MySQL has reached MySQL's limit. Usually, the maximum number of connections for mysql defaults to 100, and the maximum number can reach 16384.

MySQL Maximum number of connections View and modify

1. View the maximum number of connections after logging into the database

show variables like '%max_connections%';

2. Modify the maximum number of connections

set GLOBAL max_connections = 200;

Note: Using this method to modify the maximum number of database connections can only take effect in the current mysql service process. Once mysql restarts, it will return to the initial state. Because mysql needs to read the data in the/etc/my.cnf configuration file during initialization and startup, it is recommended to write the parameter max_connections in the mysql configuration file/etc/my.cnf.

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