Description:
According to the MySQL manual - 5.2.3. The General Query Log
"The general query log is a general record of what mysqld is doing. The server
writes information to this log when clients connect or disconnect, and it logs
each SQL statement received from clients."
See http://dev.mysql.com/doc/refman/5.1/en/query-log.html
However with 5.1 and 6.0 server, statements executed by a trigger are logged to the log as well:
Trigger statements are logged weather logging is done to tables or file.
Trigger statements are NOT logged in 5.0 server and the behavior in 5.0 matches the documentation
How to repeat:
Start the server
Log in using the mysql client and execute the following commands:
create database show_bug;
use show_bug;
create table t1 (i int);
create table t2 (j int);
create trigger trg before insert on t1 for each row
insert into t2 values (2*new.i);
insert into t1 values (1);
select * from t2;
At this point check the master.log file and you will see that the
it includes:
:
1 Query create table t1 (i int)
1 Query create table t2 (j int)
1 Query create trigger trg before insert on t1 for each row insert into t2 values (2*new.i)
1 Query insert into t1 values (1)
1 Query insert into t2 values (2*new.i) <-- Should not be logged, did not originate from the client
1 Query select * from t2
:
mysql.general_log will include similar output
Suggested fix:
Trigger based statements should not be logged