开发者

How do you get the last access (and/or write) time of a MySQL database?

开发者 https://www.devze.com 2022-12-21 04:33 出处:网络
How do you find out the last time a MySQL database was read or written to? Can you ev开发者_运维知识库en do that check per table?SELECT UPDATE_TIME

How do you find out the last time a MySQL database was read or written to?

Can you ev开发者_运维知识库en do that check per table?


SELECT UPDATE_TIME
FROM   INFORMATION_SCHEMA.TABLES
WHERE  TABLE_SCHEMA = 'dbname'
AND    TABLE_NAME = 'tabname'

Source: How can I tell when a MySQL table was last updated?


If your database has bin logs switched on, you can get the last update time using mysqlbinlog.

If your database has query logging enabled, you can get the last query time (either updates or selects) by tailing the query log.


check out command SHOW TABLE STATUS;
example: SHOW TABLE STATUS WHERE name="table_name_here", you need value from column Update_time

0

精彩评论

暂无评论...
验证码 换一张
取 消