mysqladmin ext | grep Abort | Aborted_clients | 44458 | | Aborted_connects | 546857 |
最近发现服务器这个两个值很高,没过几分钟就增长几十,查看手册
If a client successfully connects but later disconnects improperly or is terminated, the server increments theAborted_clients
status variable, and logs an Aborted connection message to the error log. The cause can be any of the following:
-
The client program did not call
mysql_close()
before exiting. -
The client had been sleeping more than
wait_timeout
orinteractive_timeout
seconds without issuing any requests to the server. SeeSection 5.1.4, “Server System Variables”. -
The client program ended abruptly in the middle of a data transfer.
If a client is unable even to connect, the server increments the Aborted_connects
status variable. Unsuccessful connection attempts can occur for the following reasons:
-
A client does not have privileges to connect to a database.
-
A client uses an incorrect password.
-
A connection packet does not contain the right information.
-
It takes more than
connect_timeout
seconds to get a connect packet. SeeSection 5.1.4, “Server System Variables”.
跟踪--使用tcpdump
tcpdump -s 1500 -w tcp.out port 3306开另一个窗口,tail -f tcp.out | strings 可以看到有连接错误信息
strings tcp.out > tcp.txtvim tcp.txt
可以看到具体的信息
Host 'XXX.XX.XX.XXX' is not allowed to connect to this MySQL server Access denied for user 'root'@'XXX.XX.XX.XXX' (using password: YES)0N