log_warnings doesn't seem to work for aborted connections in MySQL 5.1
-
22-10-2019 - |
سؤال
The docs for 5.1 say that I can set log_warnings = 2
to capture Aborted_connects
in the error log. This bug report suggests that this was only merged into 5.5 and 6.0 (and maybe 5.2) but not into 5.1.
I tried out all combinations of set global log_warnings = 2;
and set global log_warnings = 1;
followed by login attempts with valid and invalid users and invalid and no passwords results in nothing in the error log.
- Are the docs incorrect or have I made a mistake somewhere?
- Do other types of aborted connections (such as a loss of network during the login or improper permissions for the database) get logged in the error log?
- Do aborted clients get logged in the error log?
Some other things I have checked/done:
log_error
is set to/var/log/mysql/error.log
.- That file exists and the
mysqld
process has it open. - The last entry in it is from 2012/06/01.
skip-log-warnings
is not set inmy.cnf
and the process was started with no arguments.skip_log_warnings
does not exist inSHOW GLOBAL VARIABLES LIKE '%skip%'
- The uptime of MySQL is 50 days.
- I ran
FLUSH LOGS
just in case. - The version string is
5.1.62-0ubuntu0.10.04.1-log
. - The
Aborted_connects
value is increasing by one every time I try an invalid connection attempt.
المحلول
This seems to be an elusive bug nobody wants to fix
- http://bugs.mysql.com/bug.php?id=24761 (2006-12-01 : Status Triaged)
- http://bugs.mysql.com/bug.php?id=41602 (2008-12-18 : Status Closed)
- https://serverfault.com/questions/235369/how-can-i-get-mysql-5-5-to-log-warnings-to-one-of-the-log-files (2011-02-14)
According to http://bugs.mysql.com/bug.php?id=24761, the aborted connect is recorded in the general log
[29 Sep 2008 8:03] Konstantin Osipov
OK, it was fixed differently:
/*
Log the command before authentication checks, so that the user can
check the log for the tried login tried and also to detect
break-in attempts.
*/
general_log_print(thd, command,
(thd->main_security_ctx.priv_user ==
thd->main_security_ctx.user ?
(char*) "%s@%s on %s" :
(char*) "%s@%s as anonymous on %s"),
thd->main_security_ctx.user,
thd->main_security_ctx.host_or_ip,
db ? db : (char*) "");
So, this is logged in the general log at least.
I was reviewing a patch that added more logging,
but I can't remember the worklog task number.
We just have to wait on MySQL (I mean Oracle) to fix it. (That was sarcasm)
لا تنتمي إلى dba.stackexchange