elfar
elfar

Reputation: 481

mysql log files are empty although it seems that I have set eveything

I am trying to get log files for mysql server Ver 14.14 Distrib 5.5.22 running on debian-linux-gnu (x86_64) using readline 6.2

Based on several websites I uncommented these lines in /etc/mysql/my.cnf:

general_log_file        = /var/log/mysql/mysql.log 
general_log             = 1

After running mysql I checked that /var/log/mysql/mysql.log was not created. A website suggested to run two commands:

touch /var/log/mysql/mysql.log
chown mysql:mysql /var/log/mysql/mysql.log

This did not help: still no logs! The file is empty.

Upvotes: 6

Views: 23920

Answers (2)

ENargit
ENargit

Reputation: 613

I had the same issue with MySQL 5.5 at Ubuntu 14.04. Permisions and configurations were OK, but FLUSH LOGS returned

ERROR 1105 (HY000): Unknown error

Turned out, the issue was caused by incorrect AppArmor setup.

If this is the case the /var/log/syslog file contains lines like

<from kernel>: apparmor="DENIED" operation="mknod" profile="/usr/sbin/mysqld" name="/var/log/mysql/mysql.log" pid=16798 comm="mysqld" requested_mask="c" denied_mask="c" fsuid=115 ouid=115

Fix the AppArmor configuration in file /etc/apparmor.d/usr.sbin.mysqld and then restart AppArmor and MySQL.

Upvotes: 1

Shlomi Noach
Shlomi Noach

Reputation: 9394

Did you restart the server after updating the my.cnf file?

Please issue:

SELECT @@global.general_log;
SELECT @@global.general_log_file;
SELECT @@global.log_output;

These are the de-facto variables as the server sees them. You may change tgem dynamically as follows:

SET GLOBAL general_log:=1;
SET GLOBAL log_output := 'FILE';

Also, as last resort, try:

FLUSH LOGS;

to close+reopen log file descriptor.

Upvotes: 12

Related Questions