MySQL: How to create trigger for setting creation date for new rows
问题 I ran into a problem as I tried to create two TIMESTAMP columns in my database. One called created and one called updated . I figured it would be easy to set the default value of both to CURRENT_TIMESTAMP and then ON UPDATE CURRENT_TIMESTAMP for the updated column. But for some reason MySQL means that's a bad idea... so I have been looking for ways to do this without having to set one of them in the insert query. I found one way by using a trigger in this answer, but I keep getting errors. I