mysqlloggingmariadbmysqlbinlog

How to subscribe to update,delete and inserts on a mysql table?


I would like to get a notification when in certain mysql (or mariadb) tables (innodb) updates,inserts or deletes happen.

I need to track these changes from another process as soon as possible,

I was thinking maybe I could subscribe to the mysql binary log? Can somebody explain how this can be done? Is there for example a log read API that mysql offers?

Does the game change when I use a Galera cluster?


Solution

  • You may use mysqlbinlog with --stop-never option to get all insert, update, and delete statements (mysqlbinlog documentation).

    You may use the C++ library MySQL Replication Listener that is based on the binlog api.