MacOS Terminal - Watch MySQL database tables for changes?

by Birrel   Last Updated October 20, 2017 20:05 PM

Note: Previously asked in SuperUser, but zero exposure. Has been removed.


It's what it sounds like.

I'm doing a bunch of local testing, and have a server and MySQL DB set up on my system. I'm using MySQL Workbench for detailed looks into the tables, setting data, and so-on.

The Problem

Workbench works mostly fine, but it does not have any automation for reporting changes to databases. The problem is that while I'm testing, I have no way of quickly and easily knowing if a table was changed at all (i.e. INSERT, UPDATE, CREATE, etc) without going into Workbench and running a query for every table that might have been accessed/modified. Even then, it isn't always obvious if a table has been modified, and usually requires hunting-down the values/rows that would have been changed.

It's tedious and slow, especially when I'm running through large amounts of testing cases. And Workbench is only mostly stable, with a healthy amount of bugs and occasional crashes. It's been absolutely invaluable, but the less I need to use Workbench for mundane tasks, the better.


Is there a service for Terminal (MacOS), where I can enter the location of the database I want to monitor, and it will spit out a nice, succinct notification every time any of the tables within the DB are accessed and/or modified? I'm less concerned about monitoring access to tables, and more concerned with monitoring which tables were modified, and how. The more instantaneous the process, the better; this way I can monitor - in real-time - exactly what is happening and where.

After looking around, all I've found is watch, but I'll be damned if I can figure it out. If I were to use watch, how would I set it up to automatically track changes for all tables within a DB? Or, perhaps there is an existing solution outside of watch?

Ultimately, I'd love behaviour similar to that of Compass. I'd prefer not to have a constant stream every n seconds, but rather only an output when a change occurs.

Thank You

Thanks for making it this far, and thanks for any input you might have on the matter.

Tags : mysql mac bash

Related Questions

Assigning stdout to a variable in a bash script

Updated January 28, 2018 23:05 PM

How to pass confidential files from C to script

Updated February 01, 2018 14:05 PM

Best practices for managing/creating bash aliases

Updated September 20, 2018 21:05 PM