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 prompts how to solve the "too many connections" error

2025-01-16 Update From: SLTechnology News&Howtos shulou NAV: SLTechnology News&Howtos > Development >

Share

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

This article introduces the relevant knowledge of "MySQL prompt" too many connections "how to solve errors". In the operation of actual cases, many people will encounter such a dilemma, so let the editor lead you to learn how to deal with these situations. I hope you can read it carefully and be able to achieve something!

Find a problem

Recently, when I was using mysql5.7 to connect to the company's system database, I found an error message and an exception of mysql too many connection. After query, it is found that the number of connections included in mysql's system is too small, and the number of connected threads exceeds the system configuration, resulting in an error.

Solution process

1. First log in to the mysql terminal and enter show variables like max_connections to view the maximum number of connections.

Modify the maximum number of connections: set GLOBAL max_connections=1000, and check the maximum number of connections again after configuration.

two。 The reason for exceeding the number of connections is that the number of connections in mysql has been held for too long. You can modify the survival mechanism show global variables like 'wait_timeout', which is the maximum sleep time.

Modify set global wait_timeout=300; to kill threads automatically.

3. The configuration just now is temporarily modified. Rebooting mysql will fail. You can modify the configuration of mysql / etc/my.cnf.

Group_concat_max_len = 1024 maximum sleep time wait_timeout=300# timeout setting interactive_timeout = 500

After the modification, restart mysql5.7.

Find MySQL in the task manager and right-click to restart.

The reason why mysql limits the maximum number of connections

The reason is that the underlying linux operating system limits the number of file handles that a process can open to 1024, resulting in the maximum number of mysql connections.

"MySQL prompt" too many connections "how to solve the error" content is introduced here, thank you for reading. If you want to know more about the industry, you can follow the website, the editor will output more high-quality practical articles for you!

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

Development

Wechat

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

12
Report