Search the MySQL manual:

4.9.1 The Error Log

The error log file contains information indicating when mysqld was started and stopped and also any critical errors found when running.

If mysqld dies unexpectedly and mysqld_safe needs to restart mysqld, mysqld_safe will write a restarted mysqld row in this file. This log also holds a warning if mysqld notices a table that needs to be automatically checked or repaired.

On some operating systems, the error log will contain a stack trace for where mysqld died. This can be used to find out where mysqld died. See section E.1.4 Using a Stack Trace.

Beginning with MySQL 4.0.10 you can specify where mysqld stores the error log file with the option --log-error[=filename]. If no file name is given mysqld will use mysql-data-dir/'hostname'.err on Unix and `\mysql\data\mysql.err' on Windows. If you execute flush logs the old file will be prefixed with --old and mysqld will create a new empty log file.

In older MySQL versions the error log handling was done by mysqld_safe which redirected the error file to 'hostname'.err. One could change this file name with the option --err-log=filename.

If you don't specify --log-error or if you use the --console option the errors will be written to stderr (the terminal).

On Windows, the output is always written to the .err file if --console is not given.

User Comments

Posted by tengel on Thursday February 20 2003, @11:32am[Delete] [Edit]

--log-error is not supported in 3.23.55 (current stable release, as of this writing). Trying to set it in /etc/my.cnf results in an error (unrecognized option).

# scripts/mysql_install_db
Installing all prepared tables
./bin/mysqld: unrecognized option `--log-error=/opt/mydata/data/jabberjaw.err'

Posted by [name withheld] on Saturday March 29 2003, @3:45am[Delete] [Edit]

"Beginning with MySQL 4.0.10 you can specify where mysqld stores the error log file with the option --log-error[=filename]. If no file name is given mysqld will use mysql-data-dir/'hostname'.err on Unix and `\mysql\data\mysql.err' on windows."

Does seem to be true for v4.0.12 under Windows any more as it's now creating a 'hostname.err' file.

Posted by Zebee Johnstone on Thursday May 8 2003, @10:26pm[Delete] [Edit]

" If you execute flush logs the old file will be prefixed with --old and mysqld will create a new empty log file. "

Doesn't seem to work on v4.0.12 on linux - flush logs and the file, default or specifically named - is still there and being written to, and no old version is created.

Add your own comment.