Linux – MySQL 5.0 not logging aborted connections in general log

linuxMySQLmysql5redhattroubleshooting

I know there is a bug in MySQL 5.0 which prevents aborted connections from being logged in the error log (http://bugs.mysql.com/bug.php?id=24761).

However, aborted connections should still be logged in the general query log. When I tried configuring the logging for this, I still don't see aborted connections in the general log. Here is the part I configured from my.cnf:

log = /var/log/mysql_general.log

log_warnings = 2

I restarted mysqld after making those changes and then tested by telnetting to the server on port 3306 and then closing the connection. After doing so, I run:

show global status like '%abort%';

And I see the counter increment:

+------------------+-------+
| Variable_name    | Value |
+------------------+-------+
| Aborted_clients  | 0     |
| Aborted_connects | 4     |
+------------------+-------+
2 rows in set (0.00 sec)

However, I see nothing in the general logs. If I enter a bad password, that DOES show up in the logs though. But nothing about aborted connections:

/usr/sbin/mysqld, Version: 5.0.45-community-log (MySQL Community Edition (GPL)). started with:
Tcp port: 0  Unix socket: /var/lib/mysql/mysql.sock
Time                 Id Command    Argument
140126 19:19:57       2 Connect     root@localhost on
                      2 Query       select @@version_comment limit 1
140126 19:20:08       2 Query       show global status like '%abort%'
140126 19:20:11       2 Quit
140126 19:27:29       4 Connect     Access denied for user 'root'@'localhost' (using password: YES)
140126 19:27:48       5 Connect     root@localhost on
                      5 Query       select @@version_comment limit 1
140126 19:27:51       5 Query       show global status like '%abort%'
140126 19:28:01       5 Query       show global status like '%abort%'
140126 19:28:02       5 Quit
140126 23:13:39       7 Connect     root@localhost on
                      7 Query       select @@version_comment limit 1
140126 23:13:42       7 Query       show global status like '%abort%'
140126 23:13:48       7 Quit

So I have no idea what else to try to get this thing logging aborted connections, whether it be the error log, general log, or whatever the heck log. Anyone able to help me out?

Best Answer

Are you sure that bug applies to your version of MySQL. I don't believe it does. If that's the case then error should be reported in your error logs.

The errors could be getting logged to your syslog unless you have taken measures to ensure that they are not. Check for this in your my.cnf:

# Error logging goes to syslog due to /etc/mysql/conf.d/mysqld_safe_syslog.cnf.

If you don't want it going there, comment out the line in that log file:

[mysqld_safe]
#syslog

and add this to my.cnf:

[mysqld_safe]
log_error=/var/log/mysql/mysql_error.log

[mysqld]
log_error=/var/log/mysql/mysql_error.log