Bug #52330 mysqlbinlog not filtering log events for a given database
Submitted: 24 Mar 2010 14:16 Modified: 26 Mar 2010 14:00
Reporter: Ravi Thati Email Updates:
Status: Not a Bug Impact on me:
Category:MySQL Server: Command-line Clients Severity:S2 (Serious)
Version:mysqlbinlog Ver 3.3 for pc-linux OS:Any (mysqlbinlog Ver 3.3 for pc-linux-gnu at i686)
Assigned to: CPU Architecture:Any
Tags: binlog, filtering, mysqlbinlog, recovery

[24 Mar 2010 14:16] Ravi Thati

I have two issues:
I have statements like below in which the table is referred with it database name prefixed.
insert into dbname.tablename (i) values(0);

These kind of log events from binary logs are getting filtered using mysqlbinlog utility.

i am doing :
$> mysqlbinlog -d databasename mysql_bin.00001 
filtering by database does not give events mentioned above.

2. MySQL system admin events like "create user,grant privileges..etc which will be going to mysql sys database" are not coming in the output when filtering by db name 'mysql ' in mysqlbinlog utility.

How to repeat:

How to reproduce:
Create database db1;
create table db1.table1(i int);
insert into db1.table1(i) values(0);
insert into db1.table1(i) values(1);

Now locate the bin log file corresponding to these events.

mysqlbinlog -d db1 mysql_bin.000xx 
you will not get the above executed lines in the output.

Suggested fix:
For 1.
Filter events out of bin logs in any form when supplied a database name

For 2.
All sys admin events which modify system database 'mysql' must be logged properly and mysqlbinlog utility must filter them correctly.
[24 Mar 2010 14:35] Valeriy Kravchuk
This is not a bug. Our manual (http://dev.mysql.com/doc/refman/5.1/en/mysqlbinlog.html#option_mysqlbinlog_database) clearly says:

"- Unless db_name is selected as the default database, statements are not output, even if they modify tables in db_name."
[24 Mar 2010 14:39] Ravi Thati
Thanks Valeriy Kravchuk for the reply.

If that is the case, how to filter such events using mysqlbinlog utility? If there is already a way, please let me know.

How about mysql sys database events??
[24 Mar 2010 14:56] Valeriy Kravchuk
There is no way, yet, to do it with mysqlbinlog only. Check old feature request, Bug #20205.
[26 Mar 2010 14:00] Ravi Thati
Any road map set for this feature?