MySQL: how can I get the timestamp of the last insert into the database?
Disabled so as not to be the answer (cannot be deleted as is customary). See the comments below this answer.
I was unable to use information_schema.tables update_time
as the column was not updating, but create_time
it worked for that. It will work for update_time
(if changed) if update_time
updated, which may be true in your setup.
select table_schema,table_name,max_time from information_schema.tables t1 JOIN
(select MAX(t2.create_time) AS max_time FROM
information_schema.tables t2 where
table_schema ='test') as t3
on t1.create_time = t3.max_time;
source to share
This is basically what logging is .
In the CLI
- execute
SET GLOBAL log_output = 'TABLE';
- execute
SET GLOBAL general_log = 'ON';
Now the table general_log
inside mysql
will register all such actions in the database. Use phpMyadmin or similar to view them. You can query their results very efficiently.
source to share