[MySQL] Query Log File Cannot Be Specified Error / [ERROR] Could not use /var/log/myquery.log for logging (error 13)

Tadashi Shigeoka ·  Wed, September 14, 2011

When I configured MySQL’s configuration file my.cnf to output query log files, an error occurred and MySQL restart failed.

MySQL

I researched the solution, so I’ll introduce it.

First, when I had the following in my.cnf, I got a “Could not use” error:

[mysqld]
log=/var/log/myquery.log

Here’s the error content:

[root@localhost ~]# tail -f /var/log/mysqld.log 
110626 22:40:54 InnoDB: 1.1.7 started; log sequence number 1640974
/usr/libexec/mysqld: File '/var/log/myquery.log' not found (Errcode: 13)
110626 22:40:54 [ERROR] Could not use /var/log/myquery.log for logging (error 13). Turning logging off for the whole duration of the MySQL server process. To turn it on again: fix the cause, shutdown the MySQL server and restart it.

There was an article with the solution, so I’ll quote it:

[mysqld]
log

For now, this will save to /var/lib/mysql/hostname.log, which is fine, but it doesn’t feel right.

Source: Cannot specify query log file - a9b’s blog

That’s all from the Gemba.