Thursday, December 26, 2024

log-error

To specify the filename of the MySQL error log the following command line option can be used with the mysqld and mysqld_safe commands.

--log-error=/path/to/filename

Alternatively you can specify the MySQL error log using the MySQL Configuration File my.cnf, for example:

[mysqld]
log-error=/path/to/filename

[mysqld_safe]
log-error=/path/to/filename

If unspecified, the MySQL error log will be found in the MySQL data directory of the instance and will have the filename hostname.err

Determining value of log-error


You can determine the current error log for a running MySQL instance with the log_error system variable. For example with the SHOW command or the INFORMATION_SCHEMA:

mysql> SHOW GLOBAL VARIABLES LIKE 'log_error';
+---------------+----------------------------+
| Variable_name | Value                      |
+---------------+----------------------------+
| log_error     | /opt/mysql51/log/error.log |
+---------------+----------------------------+

mysql> SELECT variable_value FROM INFORMATION_SCHEMA.GLOBAL_VARIABLES
    -> WHERE variable_name='log_error';
+----------------------------+
| variable_value             |
+----------------------------+
| /opt/mysql51/log/error.log |
+----------------------------+

Additional References

Related Options

  • --syslog
  • --skip-syslog
  • --log-warnings
  • --console