Description:
This seems to be yet another form of BUG#33693, this time applied to the error log.
http://dev.mysql.com/doc/refman/5.5/en/error-log.html
says, about --log-error:
"If no file_name value is given, mysqld uses the name host_name.err by default. The server creates the file in the data directory unless an absolute path name is given to specify a different directory."
This was true but changed; looking at code it seems to have changed starting from 5.0. A more correct description of the new behaviour would be something like:
"If no file_name value is given, mysqld uses the path and name of the PID file, with a .err extension".
I verified that if --pid-file=/some/fancy/path/name --log-error is used,
then the Error log will be put into /some/fancy/path/name.err. Not in the datadir, and not named `hostname`.err, contradicting the documentation.
This is a difference from other logs (binary log, general log, slow query log), which are still put into datadir by default if no path is given, independently of the PID file.
The relevant code is in mysqld.cc:
if (opt_error_log && !opt_help)
{
if (!log_error_file_ptr[0])
fn_format(log_error_file, pidfile_name, mysql_data_home, ".err",
MY_REPLACE_EXT); /* replace '.<domain>' by '.err', bug#4997 */
...
and note that it was written this way in relation to BUG#20166.
How to repeat:
start mysqld with --log-error --pid-file=/some/fancy/path/name
you will see that the Error Log is not put into the datadir.