Getting the date/time of the last change to a MySQL database

前端 未结 4 1386
花落未央
花落未央 2021-02-07 16:21

I\'m working with MySQL and I would like to get the date/time of the very last change to any table within a database. Each of my tables has an auto updating \'*_modified\' time

4条回答
  •  攒了一身酷
    2021-02-07 16:39

    The accepted answer is great, but I think a better format in case it's not immediately apparent to a rookie would be:

    SELECT table_name, update_time
    FROM   information_schema.tables
    WHERE  table_schema = 'myDBName'
    order by update_time DESC
    

    Since, we don't always know what table(s) have been touched, and this has the bonus of giving a clue as to what the activity was by showing the most-recently-updated tables.

提交回复
热议问题