What I want to do is write a script to backup some databases, but only if they've changed. I figured that the easiest way to get a list of databases that exist, as well as which have changed, is to look in /var/lib/mysql for directories with recently changed files.
I know that find /var/lib/mysql -type d -mtime 1 .. will find directories that have changed inside 24 hours, but it does not pick up directories whose contents have changed.
Any suggestions?
(The next problem is that the user I want to run the script as does not have access to the /var/lib/mysql directory at the moment so a more elegant solution would be nice.)