How do I get the creation date of a MySQL table?

79,645

Solution 1

You would query the information_schema for the create_time of the table.

For instance:

SELECT create_time FROM INFORMATION_SCHEMA.TABLES
  WHERE table_schema = 'your_schema'
  AND table_name = 'your_table'

Reference: http://dev.mysql.com/doc/refman/5.0/en/tables-table.html

Solution 2

I know that this is an old question but I wanted to suggest an alternative approach that doesn't involve having to directly query the information_schema tables for anyone who looks up this question later for reference.

You can obtain information about the tables using "show table status". It gives you plenty of information including the storage engine being used, the create time, the update time, and the number of rows.

You can filter the results based on the name of the table, as follows:

show table status where name = 'your-table-name'
Share:
79,645
Matt Hintzke
Author by

Matt Hintzke

Software Engineer @ SkyKick in Seattle, WA. Building modern microservice applications in the Azure Cloud using a .NET, Node and Angular stack

Updated on July 05, 2022

Comments

  • Matt Hintzke
    Matt Hintzke almost 2 years

    I was wondering if it is possible to get the date that a specific table in a database was created. My employer would like to add this feature and I have been unable to find a solution with Google.

    I figured SO is the next best place to look.

  • chiliNUT
    chiliNUT almost 10 years
    better answer than the duplicate question answer
  • Bob Stein
    Bob Stein over 6 years
    Apparently broken for InnoDB tables. create_time actually reports the most recent ALTER for all InnoDB tables.
  • Bob Stein
    Bob Stein over 6 years
    Does not work for InnoDB tables.
  • Brian Lin
    Brian Lin over 5 years
    Thanks for this, this worked great on phpMyAdmin.