3

I am using phpMyAdmin for my project and I have a table without date/datetime field.

I am wondering if there's a way to know when I inserted each record on the database

HaveNoDisplayName
  • 8,291
  • 106
  • 37
  • 47
ihssan
  • 369
  • 1
  • 6
  • 24
  • 1
    possible duplicate of [MySQL Get Time of Old Record Insert?](http://stackoverflow.com/questions/12469270/mysql-get-time-of-old-record-insert) – marijnz0r May 21 '15 at 08:16

1 Answers1

1

While designing your database if you forgot to keep an extra field to store the insertion time of a row then you have only one option left to know the the insertion time.

But the condition is you must have binary logging enabled prior to it.

Reference

You may check if binary logging is enabled in your part by executing this query :

SHOW VARIABLES LIKE 'log_bin';

Further Note:

And from now on you may keep an extra field which will track the insertion time of each row.

Change your table design :

Add an extra field in your table with datatype "timestamp/datetime" with default value CURRENT_TIMESTAMP and on update CURRENT_TIMESTAMP.

1000111
  • 13,169
  • 2
  • 28
  • 37
  • 1
    thanks for you answer, unfortunately i have `log_bin` field disabled – ihssan May 21 '15 at 08:34
  • You are welcome! :) you may enable binary logging from now on. [Check this ](http://stackoverflow.com/questions/11445678/binary-log-error-in-mysql) – 1000111 May 21 '15 at 09:11