I need to track the date and time a user was created in my mysql database. I have column called ‘created’ and the data type as TIMESTAMP.
The problem is that when a user changes their password or other information the TIMESTAMP value changes. How can I set this to not change????
You may simply want to set its default clause to
CURRENT_TIMESTAMP(as @Mark and @dcp noted in the other answers):Test case:
EDIT:
In my original answer I suggested using a
DATETIMEcolumn with aDEFAULTclause set toCURRENT_TIMESTAMP. However this is only possible when using theTIMESTAMPdata type, as stated in documentation: