8

I have a problem with the mysql query-log.

I searched the used my.cnf with https://stackoverflow.com/a/2896718/1012683 and added the line log=/var/log/mysqld_query.log to my.cnf. Then I restartet mysql but there is still no query-log.

Whats wrong here?

Thanks, Flo

2 Answers 2

22

You need to set general_log to 'ON'. see here

Add this in my.cnf and then restart MySQL server:

general_log = 1
log=/var/log/mysqld_query.log

or

SET GLOBAL general_log = 'ON';
2
  • it works! i've done SET GLOBAL general_log = 'ON' and SET GLOBAL general_log_file = '/var/log/mysqld_query.log'
    – sbo
    Commented Aug 8, 2012 at 9:32
  • where is my my.cnf? stackoverflow.com/questions/2482234/…
    – thicolares
    Commented Jul 29, 2015 at 12:51
3

You can check whether the general_log is 'ON' or 'OFF' first using query:

mysql>show variables like '%log%';

if the general_log is 'OFF', then the setting of log=... will not work. The general_log can be turn on when mysql is running (do not need to restart mysql) using cmd below:

mysql>SET GLOBAL general_log = 'ON';

And the log file in variable general_log_file will be auto generated.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

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