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

How to solve the problems caused by too many mysql database connections

2025-01-18 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Database >

Share

Shulou(Shulou.com)05/31 Report--

This article mainly introduces "how to solve errors in too many mysql database connections". In daily operation, I believe that many people have doubts about how to solve problems when there are too many errors in mysql database connections. Xiaobian consulted all kinds of materials and sorted out simple and easy-to-use methods of operation. I hope it will be helpful to answer the doubts of "how to solve errors in too many mysql database connections". Next, please follow the editor to study!

Ask your engineer to change the maximum number of allowed connections for MySQL from the default 100 to 32000. This will not always have the problem of too many connections.

View max_connections

Enter MySQL and use the command:

Show variables

View the variable value of the maximum number of connections to the database:

Max_connections

Check threads_connected to enter MySQL, and use the command:

Show status looks at the value of the currently active connection thread variable:

Threads_connected sets the max_connections by adding the following last red line in the my.cnf file:

[d]

Port=3306

# socket=MySQL

Skip-locking

Set-variable = key_buffer=16K

Set-variable = max_allowed_packet=1M

Set-variable = thread_stack=64K

Set-variable = table_cache=4

Set-variable = sort_buffer=64K

Set-variable = net_buffer_length=2K

After the modification of set-variable = max_connections=32000, restart MySQL. Of course, to make sure the settings are correct, you should take a look at max_connections. Note: 1. Although 32000 is written here. However, the maximum number of connections allowed by the actual MySQL server is 16384; 2, in addition to max_connections, the other configurations mentioned above should be configured according to the needs of your system, not rigidly; 3, the maximum number of allowed connections is added, which does not increase much to the consumption of the system. 4. If your mysql uses my.ini as a configuration file, the setting is similar, but the format should be slightly modified.

At this point, the study on "how to solve too many errors in mysql database connections" is over. I hope to be able to solve everyone's doubts. The collocation of theory and practice can better help you learn, go and try it! If you want to continue to learn more related knowledge, please continue to follow the website, the editor will continue to work hard to bring you more practical articles!

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

Wechat

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

12
Report