Logo Questions Linux Laravel Mysql Ubuntu Git Menu
 

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

Tags:

mysql

In order to display some detailled information regarding customer databases in a GUI I'm currently writing, I need to know how to check in MySQL 5.7 when a certain database has been created?

like image 689
manifestor Avatar asked May 04 '18 10:05

manifestor


People also ask

How do you check when was the MySQL database created?

SELECT create_time FROM INFORMATION_SCHEMA. TABLES WHERE table_schema = 'yourDatabaseName' AND table_name = 'yourTableName'; My table name is 'skiplasttenrecords' and database is 'test'.

How can I check when my DB was created?

For a much more accurate idea of when you joined Facebook, open the Settings menu, select Your Facebook Information, and dive into the Activity Log. From here, click the earliest date on the timeline that appears on the right-hand side, then scroll right down to the bottom of the page.

How do I get the date created in SQL?

Using Table's Properties In the Object Explorer in SQL Server Management Studio, go to the database and expand it. Under the Tables folder select the table name. Right click and select Properties from the menu. You will see the created date of the table in the General section under Description.

When was DB created?

The first computer database was built in the 1960s, but the history of databases as we know them, really begins in 1970.


1 Answers

To date, MySQL doesn't have the feature to store database creation time. Though many users requested to add this feature, they haven't implemented it yet. So, it is impossible to find database creation date using any query. We should wait for any updates having that feature in future.

By the way, as the table creation date is stored inside mysql, we can treat the creation date of the oldest table of that database as the database creation date. So, we can get this using below query:

SELECT
table_schema AS Database_Name, MIN(create_time) AS Creation_Time
FROM information_schema.tables
WHERE table_schema = 'YOUR_DATABASE_NAME'
Group by table_schema;

But, obviously this is not an ideal solution.

like image 130
UkFLSUI Avatar answered Oct 13 '22 14:10

UkFLSUI