How to alter an existing column to default to the current time on insert, in MySQL?

alter, default, mysql, timestamp

Solution

It should be ..

ALTER TABLE 'table' MODIFY collumn_1 TIMESTAMP DEFAULT CURRENT_TIMESTAMP;

Problem

I'm trying to change the existing column "time_sent" to default to the time during insertion. My SQL is: ``` ALTER TABLE `email_history` alter `time_sent` set DEFAULT CURRENT_TIMESTAMP ``` I'm getting this error though: ``` MySQL said: #1064 - You have an error in your SQL syntax; check the manual that corresponds to your MySQL server version for the right syntax to use near 'CURRENT_TIMESTAMP' at line 1 ``` I've read the documentation and other (similar, but not identical) examples, and no luck. My version of MySQL is 5.0.67 I believe.

Original source