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

后端 未结 16 1837
忘了有多久
忘了有多久 2020-11-22 17:17

In the footer of my page, I would like to add something like \"last updated the xx/xx/200x\" with this date being the last time a certain mySQL table has been updated.

16条回答
  •  被撕碎了的回忆
    2020-11-22 17:42

    I don't have information_schema database, using mysql version 4.1.16, so in this case you can query this:

    SHOW TABLE STATUS FROM your_database LIKE 'your_table';
    

    It will return these columns:

    | Name      | Engine | Version | Row_format | Rows | Avg_row_length 
    | Data_length | Max_data_length | Index_length | Data_free | Auto_increment
    | Create_time | Update_time | Check_time | Collation
    | Checksum | Create_options | Comment |

    As you can see there is a column called: "Update_time" that shows you the last update time for your_table.

提交回复
热议问题