Using the --database option, you can filter events of a specific database. If you give this multiple times, only the last option will be considered. This works very well for row-based replication. But for statement-based replication and MIXED, this gives output only when the default database is selected.
The following command extracts events from the employees database:
shell> sudo mysqlbinlog /data/mysql/binlogs/server1.000001 --database=employees > binlog_extract
As explained in the MySQL 8 reference manual, suppose the binary log was created by executing these statements using statement-based-logging:
mysql>INSERT INTO test.t1 (i) VALUES(100);INSERT INTO db2.t2 (j) VALUES(200);USE test;INSERT INTO test.t1 ...