I am trying to debug a problem in PHP and I think I found a likely culprit. Mysql has aborted connections.

Is there anything in mysql logs that will help me pinpoint where the connection was dropped/why? (I have seperate DB + web Servers)

mysql> SHOW GLOBAL STATUS;
+------------------------------------------+--------------+
| Variable_name                            | Value        |
+------------------------------------------+--------------+
| Aborted_clients                          | 150          |
| Aborted_connects                         | 86496        |
有帮助吗?

解决方案

Aborted_connects are clients who attempt to connect and fail. Usually this is because of incorrect credentials (wrong password or no matching host for the user).

I would start by turning on --log-warnings as mentioned in the documentation and checking your error logs to help find the culprit of frequent connection failures.

Aborted connections can also be caused by clients trying to connect with invalid or malformed connection strings. Some monitoring applications for example just check the mysql port for connectivity and can trigger this. This blog post has some examples of using packet level monitoring to try and pinpoint the issue.

Aborted_clients are the client not closing the connection properly. PDO and MySQLi both provide methods to correctly close a scripts connection when it's done.

许可以下: CC-BY-SA归因
不隶属于 StackOverflow
scroll top