Solutions to the increase in the number of mysql connections in case of unrecoverable Question _ MySQL

Source: Internet
Author: User
Solution to the increase in the number of mysql connections in case of unrecoverable Question

Question:

The mysql connection of the company's website exceeds the limit, and the website basically cannot be moved. after analyzing the traffic, it is not caused by traffic surge or hacker attacks.

Analysis:

Log on to the mysql server and perform the following checks:

1. use show processlist to view the threads being executed by mysql. A large number of sleep and timeout threads are found.
2. kill all sleep or timeout threads. However, the number of connections immediately increases. Observe the SQL statements executed by some timeout connections, and find that there are many query timeouts related to its user table.
3. use check table user to find that the table is damaged. After the repair table user is used to repair the table, it does not improve. No way, you have to dump the table mysqldump and then import it in source mode. After observing the number of connections, we found that we have recovered to the normal level. Well, haha.

Summary:
1. the database is the same as the car, and maintenance is often required. Myisamchk, check table, and optimize table can all be used, especially optimize, which is very important for tables with large numbers of updated and long rows.
2. if you are not familiar with mysql status monitoring commands, you can use the official mysql adminiistrator GUI tool to clearly view the mysql running status.

BitsCN.com
Related Article

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.