I am using mariadb and I to investigate some issue I wanted to check the logs. To my surprise, log file is not generated for mariadb.

I suspect this cannot be the case so I am doubting my search skills.

MariaDB [(none)]> show variables like 'log_error'
    -> ;
| Variable_name | Value |
| log_error     |       |
1 row in set (0.00 sec)

I have added the entry in my.cnf still above field is coming to be empty.

[root@cslcodev11-oem ~]# cat /etc/my.cnf
!includedir /etc/mysqld/conf.d
# Disabling symbolic-links is recommended to prevent assorted security risks
### TRT-3229 #####
innodb_support_xa = 1
myisam_repair_threads = 2
myisam_recover_options = FORCE
innodb_log_buffer_size = 8M
### TRT-4685 ###
innodb_log_file_size = 512M

[root@cslcodev11-oem ~]# 

So, I want to know do we have any default location where these logs are getting generated, if the path cannot be read from config files.


After some investigation, I found this information,

Reference: https://mariadb.com/kb/en/mariadb/error-log/

Activating the Error Log

The error log is active by default. The log-error=filename option determines where the output will be written. If no file name is specified, the log will be written to host-name.err. If no absolute path is specified, the file will be written to the data directory (determined by the value of the datadir system variable).

On Unix systems, if the --log-error option is not used, the errors are written to stderr (usually, the command line).

On Windows, if the --console option is specified, and --log-error is not used, the errors are written to the console. If --log-error is present, --console is ignored.

So now I understand that due to some reason the configuration log_error in my.cnf is not considered. So as per the suggestion, on Unix system, if --log-error is not used, logs are redirected to stdout.

BUT, I am starting the service using service mysqld start command so I want to know what all options are used by default when we start the service using service mysql start? ESP, is --log-error used?

Going off the documentation, the error log should be in the default location of /var/lib/mysql and it should be named the default hostname.err, but it's just not there.

In the directory /var/lib/mysql I do have a tc.log, iblogfile0, iblogfile1, aria_log.00000001, and aria_log_control files. But I cannot read any of them, they are encrypted. Anyone know what these are?

BUT, I am starting the service using service mysqld start command so I want to know what all options are used by default when we start the service using service mysql start? ESP, is --log-error used?

After running the following command,

cat /etc/systemd/system/mysqld.service | grep "mysql"

we can see that the line that systemd uses to start the process is ExecStart=/usr/sbin/mysqld $MYSQLD_OPTS $_WSREP_NEW_CLUSTER $_WSREP_START_POSITION. The options passed to MariaDB are stored in the $MYSQLD_OPTS variable.

If we also run cat /etc/systemd/system/mysqld.service | grep "MYSQLD_OPTS" we get the following.

MYSQLD_OPTS here is for users to set in /etc/systemd/system/mariadb.service.d/MY_SPECIAL.conf
Use the [Service] section and Environment="MYSQLD_OPTS=...".

The file MY_SPECIAL.conf does not exist on my machine, as find / -name "*MY_SPECIAL*" reveals.

I do have entries for mysqld in journalctl. So I'm thinking that it uses the the systemd system logs by default for us systemd users.

On the MariaDB Knowledge base page for the error-log there is a paragraph that states.

systemd has its own logging system, and Linux distributions running systemd may log errors there instead. To view the systemd logs, use journalctl -u mariadb.

This answers the question because --log-error would be an option that could be added to MY_SPECIAL.conf file and journalctl is where mariadb logs errors by default on a systemd system.

Your Answer


By clicking "Post Your Answer", you acknowledge that you have read our updated terms of service, privacy policy and cookie policy, and that your continued use of the website is subject to these policies.

Not the answer you're looking for? Browse other questions tagged or ask your own question.