May 302013
 

A few weeks ago we had a problem with a higher number of aborted connects at work. Looking at a few suggestions from the web none of them worked. (e.g. to search tcpdump for string). Eventually enabling logging gave away the issue. Here the steps to enable logging to see what’s causing aborted connects for mysql 5.1.

root@dbslave:~# mysql -A -uroot -p -e'SHOW GLOBAL VARIABLES LIKE "general_log%"'
+------------------+--------------------+
| Variable_name    | Value              |
+------------------+--------------------+
| general_log      | ON                 |
| general_log_file | /var/log/mysql.log |
+------------------+--------------------+

root@dbslave:~# mysql -A -uroot  -p -e'SHOW GLOBAL VARIABLES LIKE "%warning%"'
+---------------+-------+
| Variable_name | Value |
+---------------+-------+
| log_warnings  | 2     |
| sql_warnings  | OFF   |
| warning_count | 0     |
+---------------+-------+

SET GLOBAL log_warnings=2;
SET GLOBAL general_log_file=’/var/log/mysql.log’;
SET GLOBAL general_log=on;

http://dev.mysql.com/doc/refman/5.0/en/communication-errors.html

Once done logging should be disabled again as the logs can get huge on a busy server.