0

I'm OCD person, I think I accidentally dropped something in my mysql.

Problem is I've around 50 databases, and I cannot manually check everything :(

Is there a way to check for these kind of changes? I tried to look at timestamps in /var/lib/mysql but it didn't help, I was looking at directory timestamps.

I also ran:

SELECT table_schema,table_name,update_time FROM information_schema.tables WHERE update_time > (NOW() - INTERVAL 1 day)

it only returned databases changed in last few secs.

  • But if you dropped a table, it wouldn't be in the information_schema anymore. Or was it an INDEX, COLUMN, FK? – Vérace Jun 30 '15 at 18:39
1

After much floundering around with the information_schema.tables table, I finally discovered the answer to your problem - update time doesn't work for InnoDB. See the points here by a.out and ajacian81.

The only way you can do this is to implement logging tables (as suggested by Bill Karwin, a bit of a MySQL/database guru).

The only other thing that I can think of is to use a backup and use a diff programme to compare the text output of queries from your current and backup database. Horrible I know, but there are tools which can do this if it's critical. There's MySQL's own (MySQLdiff - in utilities), you could try Liquibase or Flyaway (which I believe have this functionality) or Google "database diff programmes mysql".

I also found this post helpful in realising that the information_schema tables are dynamic.

Maybe I'm a bit OCD too (can't let this go! :-) ) but I also found this thread - check out the answer by Jacket - Percona may be the way to go if you are in real need of this functionality. However, it's obviously too late for your particular situation. I think it's backups for you :-(.

| improve this answer | |

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy