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.
The data directory will typically be /var/lib/mysql/ or something similar, and it will serve as the default destination for any logs that are enabled without an alternate path. The log settings are managed via a user-editable configuration file such as /etc/mysql/mysql. conf. d/mysqld.
The MySQL server uses the error log to record information relevant to the error that prevents the server from starting. The error log is located in the data directory specified in your my. ini file.
To force MySQL to start using new log files, flush the logs. Log flushing occurs when you execute a FLUSH LOGS statement or a mysqladmin flush-logs, mysqladmin refresh, mysqldump --flush-logs, or mysqldump --master-data command.
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.
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.
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With