0

The answers to this similar question are outdated: How to enable MySQL Query Log?

"How do I enable the MySQL function that logs each SQL query statement received from clients and the time that query statement has submitted? How do I analyse the log?"

I've been unable to locate any advice that actually works.

The manual is useless in this area. Overly verbose and goes on and on about WHAT the log is and WHY you'd want to use it, but no accurate info on HOW TO TURN IT ON: http://dev.mysql.com/doc/refman/5.7/en/query-log.html

Community
  • 1
  • 1
Alex R
  • 11,364
  • 15
  • 100
  • 180
  • You didn't read carefully enough. It tells you exactly how to turn it on and how to turn it off. `SET GLOBAL general_log = 'OFF';` to turn it off. Since setting variables from the terminal/prompt/whatever program to interface with MySQL is EQUAL to setting them in the .cnf file, it's actually very accurate in telling you how to do it. – N.B. Jul 24 '14 at 14:25

2 Answers2

0

Duh. When using MySQL Workbench on Windows, the "Administration - Server Status" tab will still say that the General Log is OFF, even though files are being created in c:\ProgramData\MySQL\MySQL Server 5.6\data

I added this to the my.cnf:

general-log = 1
general_log_file = "general.log"
Alex R
  • 11,364
  • 15
  • 100
  • 180
0

Well I certainly did not make use of general-log yet, but that is mostly due to the fact that practically every server I run uses replication either for HA/LB or backup purposes. With replication set you also get the bin-log, which essentialy does what you need (with a small help from mysqlbinlog tool). I've used it in couple occasions to restore the database to a given point in time (using mysql dump from time X and replay of binlog file X - Y)

for that, you might be interested in ie.:

log-bin = /var/lib/mysql/binlog/bin.log
log-bin-index = /var/lib/mysql/binlog/bin.index
expire_logs_days = 1
max_binlog_size = 1G
Radek 'Goblin' Pieczonka
  • 21,554
  • 7
  • 52
  • 48