How to find out the reason for MYSQL connection timeout and how to monitor MYSQL
Source: Internet
Author: User
How to find out the reason for MYSQL connection timeout, how to monitor MYSQL recently discovered that the database suddenly died because of too many connections, many processes are waiting, and many tables are locked .. 1. I checked that the website has no persistent connections. 2. interactive_timeout and wait_timeout are both set to 20 seconds. then I asked how to find out the connection timeout cause of MYSQL and how to monitor MYSQL.
Recently, I found that the database suddenly died because of too many connections.
Many processes are waiting, and many tables are locked ..
1. I checked that the website has no persistent connection.
2. interactive_timeout and wait_timeout are both set to 20 seconds.
The problem should be caused by some database operations, but where should I start.
If you do not check the value in real time, is there a way to check which connections exceed the maximum value set by interactive_timeout and wait_timeout.
Or which connections have encountered problems?
In this way, it is easier to find the cause with the record? Let's talk about other methods .. Thank you.
------ Solution --------------------
I usually need to record SQL statements that have been executed for a long time to monitor which programs need improvement to increase the speed.
The method is simple:
Find your mysql configuration file, add one or more sections, and remove the comments.
The first row specifies the record file address, and the second row specifies the long query time. if this time is queried, the second row specifies whether the record does not use the index query.
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