Bug #72598 FLUSH LOGS fails with error 1105 if both syslog and log-error are enabled
Submitted: 9 May 2014 21:54 Modified: 17 Jun 2014 13:11
Reporter: Elena Stepanova Email Updates:
Status: Verified Impact on me:
None 
Category:MySQL Server: Logging Severity:S3 (Non-critical)
Version:5.1, 5.5 OS:Linux (syslog-capable)
Assigned to: CPU Architecture:Any

[9 May 2014 21:54] Elena Stepanova
Description:
Originally reported as https://mariadb.atlassian.net/browse/MDEV-6220

If both --syslog for mysqld_safe and --log-error for mysqld are enabled in the corresponding config files, FLUSH LOGS ends with ERROR 1105 (Unknown error). 

I could reproduce it with MySQL 5.1 and 5.5 installed from the official debian repos (squeeze, wheezy). I don't know whether 5.6 is affected. 

How to repeat:
- install MySQL server from an official deb repo (apt-get install mysql-server);
- make sure that --syslog is enabled in the special config file;
- connect to the server and run FLUSH LOGS (works all right);
- add log-error=<path-to-file> to /etc/mysql/my.cnf, [mysqld] section;
- run /etc/init.d/mysql stop;
- if the <path-to-file> already exists, remove the file (it might be not necessary, but existance of the file seemed to affect the experiments somehow);
- run /etc/init.d/mysql start;
- connect to the server and run FLUSH LOGS (fails).
[10 May 2014 6:22] MySQL Verification Team
I recently studied a similar issue to this, where flush logs failed for different reason.  So, I concluded:

"
@ In my opinion there are three issues here:
@ .
@ 1.  mysqldump must never silently finish without error if FLUSH LOGS fails.
@ 2.  server failed on FLUSH LOGS due to unknown error.  In actual fact the
@ error from CreateFile in win32 api is "access denied" error number 5.  This
@ should be exposed properly somewhere.
@ 3.  FLUSH LOGS should close error log properly to avoid failing in (2).
@ .
"

I also filed client bug:
http://bugs.mysql.com/bug.php?id=71783
[16 Jun 2014 11:37] MySQL Verification Team
// On, Ubuntu 14.04 LTS with apt-get repo

ushastry@ushastry:~$ sudo /etc/init.d/mysql start
No directory, logging in with HOME=/
..140616 16:58:26 mysqld_safe Can't log to error log and syslog at the same time.  Remove all --log-error configuration options for --syslog to take effect.
....
 * MySQL Community Server 5.6.17 is started

mysql> select version();
+------------+
| version()  |
+------------+
| 5.6.17-log |
+------------+
1 row in set (0.00 sec)

mysql> flush logs;
Query OK, 0 rows affected (0.03 sec)

mysql> \q
Bye

So, in 5.6 - it complains about this instead of error.
[17 Jun 2014 13:11] MySQL Verification Team
Thank you for the report.
I'm able to repeat this behavior on Debian GNU/Linux 7 (wheezy).

// Installed MySQL server 5.5
root@ushastry:/home/ushastry# apt-get install mysql-server

Just followed the steps as outlined by Elena.

// 5.5
root@ushastry:/home/ushastry# /etc/init.d/mysql start
[ ok ] Starting MySQL database server: mysqld . ..
[info] Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly..
root@ushastry:/home/ushastry# mysql
Welcome to the MySQL monitor.  Commands end with ; or \g.
Your MySQL connection id is 37
Server version: 5.5.35-0+wheezy1-log (Debian)

Copyright (c) 2000, 2013, Oracle and/or its affiliates. All rights reserved.

Oracle is a registered trademark of Oracle Corporation and/or its
affiliates. Other names may be trademarks of their respective
owners.

Type 'help;' or '\h' for help. Type '\c' to clear the current input statement.

mysql> flush logs;
ERROR 1105 (HY000): Unknown error

Thanks,
Umesh
[17 Jun 2014 13:12] MySQL Verification Team
// Not able to reproduce this on Ubuntu 14.04 LTS with 5.5/5.6 APT repo's
// In both the cases - received below warning

 // Stop mysql, enable log-error, start mysql
 
 sudo /etc/init.d/mysql start
 * Starting MySQL database server mysqld                                                                                                               1
40617 11:09:59 mysqld_safe Can't log to error log and syslog at the same time.  Remove all --log-error configuration options for --syslog to take effect.
140617 11:09:59 mysqld_safe Logging to '/var/log/mysql/error.log'.
140617 11:09:59 mysqld_safe Starting mysqld daemon with databases from /var/lib/mysql
                                                                                                                                                [ OK ]
 * Checking for tables which need an upgrade, are corrupt or were 
not closed cleanly.