I am using new relic to monitor the performance of my server. Recently I noticed a very strange problem where for every 3 hours, the server will be down for 1 minute. And in the new relic report, during the server down time, there were sudden spike on the database.

The problem is I am new in system admin, I don't know how to view the database log. I am using Mariadb on a Ubuntu 14.04 machine. So, where can I find the log? I tried to view in /var/log/mysql.err, /var/log/mysql.log and /var/log/mysql/error.log there are no content inside.

I also tried grep 'mysql' /var/log/syslog, nothing found as well.

Do I need to enable the logging in mariadb config file? If so, how?

3 Answers 3


One of the ways to find out your current log file path is using the following SQL query:

show global variables like 'log_error';

The output should look something like this:

| Variable_name | Value               |
| log_error     | /var/log/mysqld.log |
  • it shows /var/log/mysql/error.log, but no content in the log. I also try show global variables like 'log'; It show log : OFF, seem the loggin is turned off. How do I enable it?
    – dev-jim
    Nov 22, 2015 at 6:25
  • 1
    No, log variable is related to general query logging. It could be that MySQL doesn't have privileges to write in /var/log/mysql/error.log. Can you check the current permissions and ownership by running ls -la /var/log/mysql/error.log? Your MySQL server is most probably running under "mysql" user, so it would make sense to change permissions and ownership with sudo chown mysql.root /var/log/mysql/error.log && sudo chmod 640 /var/log/mysql/error.log
    – Tubeless
    Nov 22, 2015 at 11:40

I had the same issue on Debian 8.5, using MariaDB 10.1.16. I put the configuration as recommended but nothing, there was no way that the error.log file was written with the errors.

At the end, look in / var / log / syslog and there were the errors and warnings

tail -f /var/log/syslog | grep mysql
  • tail: cannot open ‘/var/log/syslog’ for reading: No such file or directory
    – User
    Jan 1, 2021 at 5:41

On Fedora 35, it is located at /var/log/mariadb/mariadb.log. Perhaps for other recent Fedora versions or other distros as well.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

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